incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deedu...@apache.org
Subject [4/15] webworks commit: Provide workaround for OS 7 file rename failures.
Date Tue, 03 Apr 2012 12:59:30 GMT
Provide workaround for OS 7 file rename failures.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/cee777c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/cee777c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/cee777c2

Branch: refs/heads/master
Commit: cee777c200b71db81ca76a603ee4b92a374cf390
Parents: 46d6047
Author: Drew Walters <deedubbu@apache.org>
Authored: Fri Mar 23 11:34:53 2012 -0500
Committer: Drew Walters <deedubbu@apache.org>
Committed: Fri Mar 23 11:34:53 2012 -0500

----------------------------------------------------------------------
 .../src/org/apache/cordova/file/FileManager.java   |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/cee777c2/framework/ext/src/org/apache/cordova/file/FileManager.java
----------------------------------------------------------------------
diff --git a/framework/ext/src/org/apache/cordova/file/FileManager.java b/framework/ext/src/org/apache/cordova/file/FileManager.java
index 7bf75eb..ea01494 100644
--- a/framework/ext/src/org/apache/cordova/file/FileManager.java
+++ b/framework/ext/src/org/apache/cordova/file/FileManager.java
@@ -777,6 +777,13 @@ public class FileManager extends Plugin {
                         PluginResult.Status.IO_EXCEPTION, NOT_FOUND_ERR);
             }
 
+            if (src.isDirectory() && !srcPath.endsWith(FileUtils.FILE_SEPARATOR))
{
+                // Rename of a directory on OS 7+ is quirky in that it requires
+                // the opened file path to have a trailing slash.
+                src.close();
+                src = (FileConnection)Connector.open(srcPath + '/', Connector.READ_WRITE);
+            }
+
             // cannot delete the destination path if it is a directory that is
             // not empty
             dst = (FileConnection) Connector.open(parent + newName, Connector.READ_WRITE);


Mime
View raw message