From 97f51ab0f5c89f06530883c933b125c959b67e27 Mon Sep 17 00:00:00 2001 From: Panagiotis Kanavos Date: Tue, 24 Jan 2012 09:28:34 +0200 Subject: [PATCH] Fix for deleting local objects that don't exist in Pithos --- trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs | 6 +++--- trunk/Pithos.Core/Agents/NetworkAgent.cs | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs b/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs index 8cdb5d4..f37ff00 100644 --- a/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs +++ b/trunk/Pithos.Client.WPF/Properties/AssemblyInfo.cs @@ -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")] diff --git a/trunk/Pithos.Core/Agents/NetworkAgent.cs b/trunk/Pithos.Core/Agents/NetworkAgent.cs index 841984f..9b2f301 100644 --- a/trunk/Pithos.Core/Agents/NetworkAgent.cs +++ b/trunk/Pithos.Core/Agents/NetworkAgent.cs @@ -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); + } } } -- 1.7.10.4