You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/11/09 02:17:00 UTC
git commit: Fix issue CB-339 duplicate of WP7 issue.
Updated Branches:
refs/heads/master 468bfd029 -> bfb18b139
Fix issue CB-339 duplicate of WP7 issue.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/commit/bfb18b13
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/tree/bfb18b13
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/diff/bfb18b13
Branch: refs/heads/master
Commit: bfb18b1399b8c64830aff5d0207785a1b85c18e1
Parents: 468bfd0
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Nov 8 17:11:41 2012 -0800
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Nov 8 17:11:41 2012 -0800
----------------------------------------------------------------------
templates/standalone/cordovalib/Commands/File.cs | 18 ++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp8/blob/bfb18b13/templates/standalone/cordovalib/Commands/File.cs
----------------------------------------------------------------------
diff --git a/templates/standalone/cordovalib/Commands/File.cs b/templates/standalone/cordovalib/Commands/File.cs
index 2e650b0..9fe9e88 100644
--- a/templates/standalone/cordovalib/Commands/File.cs
+++ b/templates/standalone/cordovalib/Commands/File.cs
@@ -1354,7 +1354,6 @@ namespace WPCordovaClassLib.Cordova.Commands
}
}
- // TODO: this is NOT working, object is not valid ...
private void GetFileOrDirectory(string options, bool getDirectory)
{
FileOptions fOptions = new FileOptions();
@@ -1412,6 +1411,23 @@ namespace WPCordovaClassLib.Cordova.Commands
return;
}
+
+ // need to make sure the parent exists
+ // it is an error to create a directory whose immediate parent does not yet exist
+ // see issue: https://issues.apache.org/jira/browse/CB-339
+ string[] pathParts = path.Split('/');
+ string builtPath = pathParts[0];
+ for (int n = 1; n < pathParts.Length - 1; n++)
+ {
+ builtPath += "/" + pathParts[n];
+ if (!isoFile.DirectoryExists(builtPath))
+ {
+ Debug.WriteLine(String.Format("Error :: Parent folder \"{0}\" does not exist, when attempting to create \"{1}\"",builtPath,path));
+ DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, NOT_FOUND_ERR));
+ return;
+ }
+ }
+
if ((getDirectory) && (!isDirectory))
{
isoFile.CreateDirectory(path);