0001-use-cordova-data-storage-instead-of-temporary-filesy.patch
www/js/index.js | ||
---|---|---|
146 | 146 |
// Register rootPath |
147 | 147 |
if(typeof FileTransfer !== 'undefined' && typeof zip !== 'undefined' && typeof window.requestFileSystem === 'function'){ |
148 | 148 |
if(DEBUG){ console.log('FileSystem access'); } |
149 | ||
150 |
try { |
|
151 |
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, |
|
152 |
function(fileSystem){ |
|
153 |
app.rootPath = fileSystem.root.toURL(); |
|
154 |
}, |
|
155 |
function(err){ |
|
156 |
if(DEBUG){ console.log('FileSystem unreachable'); } |
|
157 |
app.flash("Impossible d'écrire sur le périphérique", 'danger'); |
|
158 |
app.rootPath = DEBUG_WWW_URL; |
|
159 |
} |
|
160 |
); |
|
161 |
} catch(e) { |
|
162 |
if(DEBUG){ console.log('FileSystem error'+e.message); } |
|
163 |
app.rootPath = DEBUG_WWW_URL; |
|
164 |
} |
|
149 |
app.rootPath = cordova.file.dataDirectory; |
|
165 | 150 |
} else { |
166 | 151 |
if(DEBUG){ console.log('FileSystem unavaible'); } |
167 | 152 |
app.rootPath = DEBUG_WWW_URL; |
... | ... | |
385 | 370 | |
386 | 371 |
var onFileSystemGet = function(fileSystem){ |
387 | 372 |
// Get fileSystem's relative cache folder |
388 |
var rootPath = app.rootPath = fileSystem.root.toURL();
|
|
373 |
var rootPath = app.rootPath = cordova.file.dataDirectory;
|
|
389 | 374 | |
390 | 375 |
// Callback |
391 | 376 |
cb(patch(response, rootPath)); |
... | ... | |
415 | 400 | |
416 | 401 |
var onFileSystemGet = function(fileSystem){ |
417 | 402 | |
418 |
var rootPath = app.rootPath = fileSystem.root.toURL();
|
|
403 |
var rootPath = app.rootPath = cordova.file.dataDirectory;
|
|
419 | 404 |
var fileTransfer = new FileTransfer(); |
420 | 405 |
var uri = encodeURI(app.manifest.meta.assetsUrl); |
421 | 406 |
var filePath = fileSystem.root.toURL() + uri.substr(uri.lastIndexOf("/") + 1); |
422 |
- |