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/05/14 21:26:18 UTC

[2/3] wp7 commit: filepath contains the extra slash to match other devices, and passes tests that expect specific filepath string values, although cannonically the same

filepath contains the extra slash to match other devices, and passes tests that expect specific filepath string values, although cannonically the same


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

Branch: refs/heads/master
Commit: dfc5f2bbc8106a1d3a4cbf451b8b2a2a614e0614
Parents: b9ab242
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon May 14 10:09:49 2012 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon May 14 10:09:49 2012 -0700

----------------------------------------------------------------------
 framework/Cordova/Commands/File.cs |   39 +++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-wp7/blob/dfc5f2bb/framework/Cordova/Commands/File.cs
----------------------------------------------------------------------
diff --git a/framework/Cordova/Commands/File.cs b/framework/Cordova/Commands/File.cs
index a8c14b2..da3f6e4 100644
--- a/framework/Cordova/Commands/File.cs
+++ b/framework/Cordova/Commands/File.cs
@@ -83,8 +83,22 @@ namespace WP7CordovaClassLib.Cordova.Commands
             /// <summary>
             /// File path
             /// </summary>
+            /// 
+            private string _fileName;
             [DataMember(Name = "fileName")]
-            public string FilePath { get; set; }
+            public string FilePath 
+            {
+                get
+                {
+                    return this._fileName;
+                }
+
+                set
+                {
+                    int index = value.IndexOfAny(new char[] {'#','?'});
+                    this._fileName = index > -1 ? value.Substring(0, index) : value;
+                }
+            }
 
             /// <summary>
             /// Full entryPath
@@ -113,8 +127,22 @@ namespace WP7CordovaClassLib.Cordova.Commands
             /// <summary>
             /// Uri to get file
             /// </summary>
+            /// 
+            private string _uri;
             [DataMember(Name = "uri")]
-            public string Uri { get; set; }
+            public string Uri 
+            {
+                get
+                {
+                    return this._uri;
+                }
+
+                set
+                {
+                    int index = value.IndexOfAny(new char[] { '#', '?' });
+                    this._uri = index > -1 ? value.Substring(0, index) : value;
+                }
+            }
 
             /// <summary>
             /// Size to truncate file
@@ -715,8 +743,8 @@ namespace WP7CordovaClassLib.Cordova.Commands
                     }
                     else if (isoFile.DirectoryExists(fileOptions.FullPath))
                     {
-                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK,
-                        new ModificationMetadata() { modificationTime = isoFile.GetLastWriteTime(fileOptions.FullPath).DateTime.ToString() }));
+                        string modTime = isoFile.GetLastWriteTime(fileOptions.FullPath).DateTime.ToString();
+                        DispatchCommandResult(new PluginResult(PluginResult.Status.OK, new ModificationMetadata() { modificationTime = modTime }));
                     }
                     else
                     {
@@ -1323,7 +1351,7 @@ namespace WP7CordovaClassLib.Cordova.Commands
 
                 try
                 {
-                    path = Path.Combine(fileOptions.FullPath, fileOptions.Path);
+                    path = Path.Combine(fileOptions.FullPath + "/", fileOptions.Path);
                 }
                 catch (Exception)
                 {
@@ -1404,6 +1432,7 @@ namespace WP7CordovaClassLib.Cordova.Commands
 
         private static string AddSlashToDirectory(string dirPath)
         {
+            Debug.WriteLine("AddSlashToDirectory :: " + dirPath);
             if (dirPath.EndsWith("/"))
             {
                 return dirPath;