Revision d9b1cbeb trunk/Pithos.Core/Agents/NetworkAgent.cs
b/trunk/Pithos.Core/Agents/NetworkAgent.cs | ||
---|---|---|
674 | 674 |
&& |
675 | 675 |
state.FilePath.StartsWith(accountInfo.AccountPath)).ToList();*/ |
676 | 676 |
|
677 |
|
|
677 | 678 |
var deleteCandidates = FileState.Queryable |
678 | 679 |
.Where(state => state.Modified <= pollTime |
679 | 680 |
&& |
680 | 681 |
state.FilePath.StartsWith(accountInfo.AccountPath) |
681 | 682 |
&& state.FileStatus != FileStatus.Conflict).ToList(); |
682 |
/* |
|
683 |
var deleteCandidates = (from state in FileState.Queryable |
|
684 |
where |
|
685 |
state.Modified <= pollTime |
|
686 |
&& state.FilePath.StartsWith(accountInfo.AccountPath) |
|
687 |
&& state.FileStatus != FileStatus.Conflict |
|
688 |
select state).ToList(); |
|
689 |
*/ |
|
690 | 683 |
|
684 |
//TODO: filesToDelete must take into account the Others container |
|
691 | 685 |
var filesToDelete = (from deleteCandidate in deleteCandidates |
692 | 686 |
let localFile = FileInfoExtensions.FromPath(deleteCandidate.FilePath) |
693 | 687 |
let relativeFilePath = localFile.AsRelativeTo(accountInfo.AccountPath) |
694 |
where !cloudFiles.Any(r => Path.Combine(r.Container, r.Name) == relativeFilePath) |
|
688 |
where !cloudFiles.Any(r => |
|
689 |
Path.Combine(r.Container, r.Name) == relativeFilePath || //Own file |
|
690 |
Path.Combine(FolderConstants.OthersFolder,r.Account, r.Container, r.Name) == relativeFilePath //Shared file |
|
691 |
) |
|
695 | 692 |
select localFile).ToList(); |
696 | 693 |
|
697 | 694 |
//On the first run |
... | ... | |
709 | 706 |
{ |
710 | 707 |
foreach (var item in filesToDelete) |
711 | 708 |
{ |
712 |
item.Delete(); |
|
709 |
if (item.Exists) |
|
710 |
{ |
|
711 |
if ((item.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) |
|
712 |
{ |
|
713 |
item.Attributes = item.Attributes & ~FileAttributes.ReadOnly; |
|
714 |
|
|
715 |
} |
|
716 |
item.Delete(); |
|
717 |
} |
|
713 | 718 |
StatusKeeper.ClearFileStatus(item.FullName); |
714 | 719 |
} |
715 | 720 |
StatusNotification.NotifyForFiles(filesToDelete, String.Format("{0} files were deleted",filesToDelete.Count),TraceLevel.Info); |
Also available in: Unified diff