Fixed bug that didn't record skipped uploads, resulting in repeated upload attempts...
[pithos-ms-client] / trunk / Pithos.Core / Agents / Uploader.cs
index c6e7441..1506dad 100644 (file)
@@ -106,17 +106,23 @@ namespace Pithos.Core.Agents
                             //If this a shared file\r
                             if (!cloudFile.Account.Equals(action.AccountInfo.UserName,StringComparison.InvariantCultureIgnoreCase))\r
                             {\r
-                                //If this is a read-only file, do not upload changes\r
+                                \r
+/*\r
                                 if (!cloudInfo.IsWritable(action.AccountInfo.UserName))\r
                                 {\r
                                     MakeFileReadOnly(fullFileName);\r
+                                    StatusKeeper.SetFileState(fullFileName, FileStatus.Unchanged, FileOverlayStatus.Normal, "");\r
                                     return;\r
                                 }\r
+*/\r
 \r
-                                //If the file is new, can we upload it?\r
-                                if ( !cloudInfo.Exists && !client.CanUpload(account, cloudFile))\r
+                                //If this is a read-only file, do not upload changes\r
+                                if ( !cloudInfo.IsWritable(action.AccountInfo.UserName) ||\r
+                                    //If the file is new, but we can't upload it\r
+                                    (!cloudInfo.Exists && !client.CanUpload(account, cloudFile)) )\r
                                 {\r
                                     MakeFileReadOnly(fullFileName);\r
+                                    StatusKeeper.SetFileState(fullFileName, FileStatus.Unchanged, FileOverlayStatus.Normal, "");\r
                                     return;\r
                                 }\r
 \r
@@ -219,7 +225,7 @@ namespace Pithos.Core.Agents
             //Do not make any modifications if not necessary\r
             if (attributes.HasFlag(FileAttributes.ReadOnly))\r
                 return;\r
-            File.SetAttributes(fullFileName, attributes | FileAttributes.ReadOnly);\r
+            File.SetAttributes(fullFileName, attributes | FileAttributes.ReadOnly);            \r
         }\r
 \r
         private static AccountInfo GetSharerAccount(string relativePath, AccountInfo accountInfo)\r