UPD/fsoCopy: set targetPath for mountPoint in TMountedFileSource for TWcxArchiveFileSource

This commit is contained in:
rich2014 2025-01-30 11:25:54 +08:00
commit 319c47f67d
2 changed files with 37 additions and 5 deletions

View file

@ -7,8 +7,8 @@ interface
uses
Classes, SysUtils, Generics.Collections,
uFile, uFileSource, uFileSourceManager,
uFileSystemFileSource, uFileSystemMoveOperation,
uFileSourceOperation, uFileSourceOperationTypes,
uFileSystemFileSource, uWcxArchiveFileSource,
uFileSourceOperation, uFileSourceOperationTypes, uFileSystemMoveOperation,
uDCUtils, DCStrUtils;
type
@ -78,7 +78,9 @@ type
TMountedFileSourceProcessor = class( TFileSystemFileSourceProcessor )
private
procedure resolveRealPath( var params: TFileSourceConsultParams );
procedure calcTargetPath( var params: TFileSourceConsultParams );
public
procedure consultOperation(var params: TFileSourceConsultParams); override;
procedure confirmOperation( var params: TFileSourceConsultParams ); override;
end;
@ -260,6 +262,36 @@ begin
params.files.Path:= calcBasePath;
end;
procedure TMountedFileSourceProcessor.calcTargetPath(var params: TFileSourceConsultParams);
var
mountedFS: TMountedFileSource;
mountPoint: TMountPoint;
realPath: String;
begin
if params.currentFS <> params.sourceFS then
Exit;
if NOT params.partnerFS.IsClass(TWcxArchiveFileSource) then
Exit;
mountedFS:= params.currentFS as TMountedFileSource;
realPath:= params.files[0].FullPath;
mountPoint:= mountedFS.getMountPointFromPath( realPath );
if mountPoint = nil then
Exit;
params.targetPath:= IncludeTrailingPathDelimiter(params.targetPath) + mountPoint.name + PathDelim;
end;
procedure TMountedFileSourceProcessor.consultOperation(
var params: TFileSourceConsultParams);
begin
inherited consultOperation( params );
case params.operationType of
fsoCopy, fsoMove:
self.calcTargetPath( params );
end;
end;
procedure TMountedFileSourceProcessor.confirmOperation( var params: TFileSourceConsultParams );
begin
inherited confirmOperation( params );

View file

@ -3678,11 +3678,11 @@ begin
if (SourceFiles.Count = 1) and
((not (SourceFiles[0].IsDirectory or SourceFiles[0].IsLinkToDirectory)) or
(TargetPath = ''))
(params.targetPath = ''))
then
params.targetPath := TargetPath + ReplaceInvalidChars(SourceFiles[0].Name)
params.targetPath := params.targetPath + ReplaceInvalidChars(SourceFiles[0].Name)
else
params.targetPath := TargetPath + '*.*';
params.targetPath := params.targetPath + '*.*';
if bShowDialog then
begin