From 4aba4d7597005af1efa12f420e01d5f938ad60d8 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 25 Oct 2009 18:11:35 +0100 Subject: Clean VFS API up a little Strictly split archiving and networking mode, get rid of prefixes --- UCore.pas | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'UCore.pas') diff --git a/UCore.pas b/UCore.pas index 5481bf9..dd9cd9e 100644 --- a/UCore.pas +++ b/UCore.pas @@ -972,17 +972,29 @@ var DefResponse: integer; // Global variables for this function function IsOnSameFS(SrcPath, DestPath: string): boolean; begin -// DebugMsg(['### IsOnSameFS: "', SrcPath, '" vs. "', DestPath, '"'#10'## Prefix = "', SenderThread.SrcEngine.GetPrefix, '" vs. "', SenderThread.DestEngine.GetPrefix, '"']); - with SenderThread do - if SrcEngine.GetPrefix <> DestEngine.GetPrefix - then Result := False - else Result := DestEngine.IsOnSameFS(SrcPath, DestPath); + with SenderThread do begin + if (SrcEngine.ClassName <> DestEngine.ClassName) then Result := False else + if (SrcEngine is TVFSEngine) and (DestEngine is TVFSEngine) and + (SrcEngine as TVFSEngine).ArchiveMode and (DestEngine as TVFSEngine).ArchiveMode and + ((SrcEngine as TVFSEngine).ArchivePath <> '') and + ((SrcEngine as TVFSEngine).ArchivePath = (DestEngine as TVFSEngine).ArchivePath) + then Result := True else + Result := DestEngine.IsOnSameFS(SrcPath, DestPath); + end; end; function TwoSameFiles(Path1, Path2: string; TestCaseInsensitiveFS: boolean): boolean; begin with SenderThread do begin - if SrcEngine.GetPrefix <> DestEngine.GetPrefix then Result := False else + if (SrcEngine.ClassName <> DestEngine.ClassName) then Result := False else + if (SrcEngine is TVFSEngine) and (DestEngine is TVFSEngine) and + ((SrcEngine as TVFSEngine).ArchiveMode <> (DestEngine as TVFSEngine).ArchiveMode) + then Result := False else + if (SrcEngine is TVFSEngine) and (DestEngine is TVFSEngine) and + (SrcEngine as TVFSEngine).ArchiveMode and (DestEngine as TVFSEngine).ArchiveMode and + ((SrcEngine as TVFSEngine).ArchivePath <> '') and + ((SrcEngine as TVFSEngine).ArchivePath <> (DestEngine as TVFSEngine).ArchivePath) + then Result := False else if WideCompareStr(Path1, Path2) = 0 then Result := True else Result := TestCaseInsensitiveFS and DestEngine.TwoSameFiles(Path1, Path2); end; @@ -1330,10 +1342,13 @@ begin PDataItemSL(List[i])^.IsDir and (not PDataItemSL(List[i])^.IsLnk)); // DebugMsg(['s2 = ', Copy(PDataItemSL(List[i])^.AName, Length(CurrPath) + 1, Length(PDataItemSL(List[i])^.AName) - Length(CurrPath)), ', s = ', s]); end; - if SrcEngine is TVFSEngine then UpdateCaption1(Format(LANGFromS, [Format(ConstFullPathFormatStr, [SrcEngine.GetPrefix, string(PDataItemSL(List[i])^.FDisplayName)])])) - else UpdateCaption1(Format(LANGFromS, [string(PDataItemSL(List[i])^.FDisplayName)])); - if DestEngine is TVFSEngine then UpdateCaption2(Format(LANGToS, [Format(ConstFullPathFormatStr, [DestEngine.GetPrefix, StrToUTF8(s)])])) - else UpdateCaption2(Format(LANGToS, [StrToUTF8(s)])); + + if not (SrcEngine is TVFSEngine) then UpdateCaption1(Format(LANGFromS, [string(PDataItemSL(List[i])^.FDisplayName)])) else + if (SrcEngine as TVFSEngine).ArchiveMode then UpdateCaption1(Format(LANGFromS, [Format(ConstFullPathFormatStr, [(SrcEngine as TVFSEngine).ArchivePath, string(PDataItemSL(List[i])^.FDisplayName)])])) + else UpdateCaption1(Format(LANGFromS, [GetURIPrefix((SrcEngine as TVFSEngine).GetPathURI) + StrToUTF8(string(PDataItemSL(List[i])^.FDisplayName))])); + if not (DestEngine is TVFSEngine) then UpdateCaption2(Format(LANGToS, [StrToUTF8(s)])) else + if (DestEngine as TVFSEngine).ArchiveMode then UpdateCaption2(Format(LANGToS, [Format(ConstFullPathFormatStr, [(DestEngine as TVFSEngine).ArchivePath, StrToUTF8(s)])])) + else UpdateCaption2(Format(LANGToS, [GetURIPrefix((DestEngine as TVFSEngine).GetPathURI) + StrToUTF8(s)])); CommitGUIUpdate; if TwoSameFiles(s, string(PDataItemSL(List[i])^.FName), ParamBool3) and (not PDataItemSL(List[i])^.IsDir) then begin FCancelMessage := LANGCannotCopyFileToItself; @@ -2958,7 +2973,6 @@ begin if APlugin <> nil then begin xEngine := TVFSEngine.Create(APlugin); xEngine.ParentEngine := AEngine; - xEngine.ArchiveMode := True; AEngine.LastHighlightItem := AHighlightItem; xEngine.SavePath := AEngine.Path; // AEngine must be set here since VFSOpenEx callbacks will reference it -- cgit v1.2.3