Fix for deleting local objects that don't exist in Pithos
authorPanagiotis Kanavos <pkanavos@gmail.com>
Tue, 24 Jan 2012 07:28:34 +0000 (09:28 +0200)
committerPanagiotis Kanavos <pkanavos@gmail.com>
Tue, 24 Jan 2012 07:28:34 +0000 (09:28 +0200)
trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs
trunk/Pithos.Core/Agents/NetworkAgent.cs

index 8cdb5d4..f37ff00 100644 (file)
@@ -12,10 +12,10 @@ using System.Windows;
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("GRNet")]
 [assembly: AssemblyProduct("Pithos Client for Windows")]
-[assembly: AssemblyCopyright("Copyright © GRNet 2011")]
+[assembly: AssemblyCopyright("Copyright © GRNet 2011-2012")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-[assembly: AssemblyInformationalVersion("2012-01-10")]
+[assembly: AssemblyInformationalVersion("2012-01-24")]
 
 // Setting ComVisible to false makes the types in this assembly not visible 
 // to COM components.  If you need to access a type in this assembly from 
@@ -52,4 +52,4 @@ using System.Windows;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.27002")]
+[assembly: AssemblyVersion("1.0.0.27004")]
index 841984f..9b2f301 100644 (file)
@@ -630,16 +630,18 @@ namespace Pithos.Core.Agents
             if (_firstPoll) return;
 
             var deleteCandidates = from state in FileState.Queryable
-                                   let stateUrl = FileInfoExtensions.FromPath(state.FilePath)
-                                       .AsRelativeUrlTo(accountInfo.AccountPath)
-                                   where state.Modified <= pollTime &&
-                                         !cloudFiles.Any(r => r.Name == stateUrl)
+                                   where state.Modified <= pollTime && state.FilePath.StartsWith(accountInfo.AccountPath)
                                    select state;
 
             foreach (var deleteCandidate in deleteCandidates)
             {
-                File.Delete(deleteCandidate.FilePath);
-                StatusKeeper.ClearFileStatus(deleteCandidate.FilePath);
+                var localFile = FileInfoExtensions.FromPath(deleteCandidate.FilePath);
+                var relativeFilePath=localFile.AsRelativeTo(accountInfo.AccountPath);
+                if (!cloudFiles.Any(r => Path.Combine(r.Container, r.Name) == relativeFilePath))
+                {
+                    localFile.Delete();
+                    StatusKeeper.ClearFileStatus(deleteCandidate.FilePath);
+                }
             }
         }