Fix for directory renames
[pithos-ms-client] / trunk / Pithos.Core / Agents / PollAgent.cs
index d77b835..275fdaa 100644 (file)
@@ -788,9 +788,6 @@ namespace Pithos.Core.Agents
 \r
         private async Task<bool> MoveForLocalMove(AccountInfo accountInfo, StateTuple tuple)\r
         {\r
-            //Is the file a directory or previous path missing?\r
-            if (tuple.FileInfo is DirectoryInfo)\r
-                return false;\r
             //Is the previous path missing?\r
             if (String.IsNullOrWhiteSpace(tuple.OldFullPath))\r
                 return false;\r
@@ -812,6 +809,7 @@ namespace Pithos.Core.Agents
 \r
                 var client = new CloudFilesClient(accountInfo);\r
                 var objectInfo = CloudAction.CreateObjectInfoFor(accountInfo, tuple.FileInfo);\r
+                objectInfo.X_Object_Hash = tuple.Merkle.TopHash.ToHashString();\r
                 var containerPath = Path.Combine(accountInfo.AccountPath, objectInfo.Container.ToUnescapedString());\r
                 //TODO: SImplify these multiple conversions from and to Uris\r
                 var oldName = tuple.OldFullPath.AsRelativeTo(containerPath);\r
@@ -820,6 +818,9 @@ namespace Pithos.Core.Agents
                 {\r
                     await client.MoveObject(objectInfo.Account, objectInfo.Container, oldName.Replace('\\','/').ToEscapedUri(),\r
                                                           objectInfo.Container, objectInfo.Name).ConfigureAwait(false);\r
+                    StatusKeeper.MoveFileState(tuple.OldFullPath, tuple.FilePath, objectInfo, tuple.Merkle);\r
+                    //StatusKeeper.StoreInfo(tuple.FilePath,objectInfo,tuple.Merkle);\r
+                    //StatusKeeper.ClearFolderStatus(tuple.FilePath);\r
                 }\r
                 return true;\r
             }\r