diff options
author | Struan Donald <struan@exo.org.uk> | 2013-07-16 12:03:56 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-07-16 12:03:56 +0100 |
commit | cde2222efa4963d9f8458b7dba7b09e3b6b68046 (patch) | |
tree | 5df1392ce3a34519a224ac872d22484697119d2a /src/js/files.js | |
parent | 54a2ef1075b50fc8759c2179e044ed06f8a88047 (diff) |
use a unique name for each photo added to a report in order to get round
what seem to be iOS caching issues on the photo screen if you add,
remove and then add a photo. Previously it would display the original
photo rather than the new one.
Diffstat (limited to 'src/js/files.js')
-rw-r--r-- | src/js/files.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/js/files.js b/src/js/files.js index 583011a..5a4604d 100644 --- a/src/js/files.js +++ b/src/js/files.js @@ -7,7 +7,7 @@ _.extend(FMS, { files: { // move a file at from a uri to a desination directory. maintains file name - moveURI: function (srcURI, dest ) { + moveURI: function (srcURI, newName ) { var fileEntry; return getFileFromURI(srcURI) @@ -22,11 +22,11 @@ return getDirectory(filesystem.root, CONFIG.FILES_DIR, {create: true}); }) .pipe( function(directory) { - return moveFile( fileEntry, directory ); + return moveFile( fileEntry, directory, newName ); }); }, - copyURI: function (srcURI, dest ) { + copyURI: function (srcURI, newName ) { var fileEntry; return getFileFromURI(srcURI) @@ -41,7 +41,7 @@ return getDirectory(filesystem.root, CONFIG.FILES_DIR, {create: true}); }) .pipe( function(directory) { - return copyFile( fileEntry, directory ); + return copyFile( fileEntry, directory, newName ); }); }, @@ -122,7 +122,7 @@ return file.promise(); } - function moveFile (src, dest, options) { + function moveFile (src, dest, newName) { console.log( 'moveing file ' + src.fullPath + ' to ' + dest.fullPath ); @@ -135,13 +135,13 @@ move.resolve( src ); } else { console.log('paths differ so moving'); - src.moveTo( dest, null, move.resolve, move.reject); + src.moveTo( dest, newName, move.resolve, move.reject); } return move.promise(); } - function copyFile (src, dest, options) { + function copyFile (src, dest, newName) { console.log( 'copying file ' + src.fullPath + ' to ' + dest.fullPath ); @@ -154,7 +154,7 @@ copy.resolve( src ); } else { console.log('paths differ so copying'); - src.copyTo( dest, null, copy.resolve, copy.reject); + src.copyTo( dest, newName, copy.resolve, copy.reject); } return copy.promise(); |