summaryrefslogtreecommitdiff
path: root/UCore.pas
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-10-25 18:11:35 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-10-25 18:11:35 +0100
commit4aba4d7597005af1efa12f420e01d5f938ad60d8 (patch)
tree1fbfbffb402f18e54883bddb31780b9581ad5d0d /UCore.pas
parent53c1df30e07af532133db05ee0254f9c1dae66f7 (diff)
downloadtuxcmd-4aba4d7597005af1efa12f420e01d5f938ad60d8.tar.xz
Clean VFS API up a littlev0.6.69
Strictly split archiving and networking mode, get rid of prefixes
Diffstat (limited to 'UCore.pas')
-rw-r--r--UCore.pas36
1 files changed, 25 insertions, 11 deletions
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