You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by za...@apache.org on 2014/08/27 13:46:01 UTC

[1/2] git commit: Overwrite existing file on getFile when create is true

Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master dd51229d9 -> ad05e3203


Overwrite existing file on getFile when create is true


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/e393c3cb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/e393c3cb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/e393c3cb

Branch: refs/heads/master
Commit: e393c3cbcb22475f58f03549bd5b52943a522946
Parents: 3086907
Author: Rodrigo Silveira <ro...@outlook.com>
Authored: Tue Aug 19 14:49:34 2014 -0700
Committer: Rodrigo Silveira <ro...@outlook.com>
Committed: Tue Aug 19 14:49:34 2014 -0700

----------------------------------------------------------------------
 src/firefoxos/FileProxy.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/e393c3cb/src/firefoxos/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/FileProxy.js b/src/firefoxos/FileProxy.js
index b4b5f1b..3662edc 100644
--- a/src/firefoxos/FileProxy.js
+++ b/src/firefoxos/FileProxy.js
@@ -136,7 +136,19 @@ QUIRKS:
                 idb_.put(newFileEntry, path.storagePath, successCallback, errorCallback);
             } else if (options.create === true && fileEntry) {
                 if (fileEntry.isFile) {
-                    successCallback(fileEntryFromIdbEntry(fileEntry));
+                    // Overwrite file, delete then create new.
+                    idb_['delete'](path.storagePath, function() {
+                        var newFileEntry = new FileEntry(path.fileName, path.fullPath, new FileSystem(path.fsName, fs_.root));
+
+                        newFileEntry.file_ = new MyFile({
+                            size: 0,
+                            name: newFileEntry.name,
+                            lastModifiedDate: new Date(),
+                            storagePath: path.storagePath
+                        });
+
+                        idb_.put(newFileEntry, path.storagePath, successCallback, errorCallback);
+                    }, errorCallback);
                 } else {
                     if (errorCallback) {
                         errorCallback(FileError.INVALID_MODIFICATION_ERR);


[2/2] git commit: Merge remote-tracking branch 'rodrigo/overwrite-create'

Posted by za...@apache.org.
Merge remote-tracking branch 'rodrigo/overwrite-create'


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/ad05e320
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/ad05e320
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/ad05e320

Branch: refs/heads/master
Commit: ad05e3203c416eb0fabc2a12e19df205b210ea1b
Parents: dd51229 e393c3c
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Wed Aug 27 13:45:46 2014 +0200
Committer: Piotr Zalewa <pi...@zalewa.info>
Committed: Wed Aug 27 13:45:46 2014 +0200

----------------------------------------------------------------------
 src/firefoxos/FileProxy.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------