mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: improve sourcePath/targetPath when copying from iCloud to MultiArchive/7z
This commit is contained in:
parent
0e7285f3e0
commit
54d6654ad1
2 changed files with 53 additions and 19 deletions
|
|
@ -8,7 +8,7 @@ uses
|
|||
Classes, SysUtils, Generics.Collections,
|
||||
Dialogs,
|
||||
uFile, uFileSource, uFileSourceManager,
|
||||
uFileSystemFileSource, uArchiveFileSource,
|
||||
uFileSystemFileSource, uWcxArchiveFileSource,
|
||||
uFileSourceProperty, uFileSourceOperation, uFileSourceOperationTypes,
|
||||
uLng, uDCUtils, DCStrUtils;
|
||||
|
||||
|
|
@ -81,6 +81,11 @@ type
|
|||
procedure consultCopyOperation(var params: TFileSourceConsultParams);
|
||||
procedure consultMoveOperation(var params: TFileSourceConsultParams);
|
||||
procedure consultPackOperation(var params: TFileSourceConsultParams);
|
||||
protected
|
||||
function calcSourcePath(
|
||||
const mountedFS: TMountedFileSource;
|
||||
const targetFS: IFileSource;
|
||||
const realPath: String ): String; virtual;
|
||||
public
|
||||
procedure consultOperation(var params: TFileSourceConsultParams); override;
|
||||
procedure confirmOperation( var params: TFileSourceConsultParams ); override;
|
||||
|
|
@ -261,20 +266,7 @@ var
|
|||
mountedFS: TMountedFileSource;
|
||||
pathType: TPathType;
|
||||
targetPath: String;
|
||||
|
||||
function calcBasePath: String;
|
||||
var
|
||||
realPath: String;
|
||||
mountPoint: TMountPoint;
|
||||
begin
|
||||
realPath:= params.files[0].FullPath;
|
||||
mountPoint:= mountedFS.getMountPointFromPath( realPath );
|
||||
if mountPoint <> nil then
|
||||
Result:= mountPoint.path
|
||||
else
|
||||
Result:= GetParentDir( realPath );
|
||||
end;
|
||||
|
||||
realPath: String;
|
||||
begin
|
||||
mountedFS:= params.currentFS as TMountedFileSource;
|
||||
targetPath:= params.targetPath;
|
||||
|
|
@ -289,8 +281,10 @@ begin
|
|||
params.resultTargetPath:= mountedFS.getRealPath( targetPath );
|
||||
end;
|
||||
|
||||
if params.phase=TFileSourceConsultPhase.source then
|
||||
params.files.Path:= calcBasePath;
|
||||
if params.phase=TFileSourceConsultPhase.source then begin
|
||||
realPath:= params.files[0].FullPath;
|
||||
params.files.Path:= calcSourcePath( mountedFS, params.targetFS, realPath );
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMountedFileSourceProcessor.calcTargetPath(var params: TFileSourceConsultParams);
|
||||
|
|
@ -301,7 +295,7 @@ var
|
|||
begin
|
||||
if params.phase<>TFileSourceConsultPhase.source then
|
||||
Exit;
|
||||
if NOT params.partnerFS.IsClass(TArchiveFileSource) then
|
||||
if NOT params.partnerFS.IsClass(TWcxArchiveFileSource) then
|
||||
Exit;
|
||||
|
||||
mountedFS:= params.currentFS as TMountedFileSource;
|
||||
|
|
@ -374,6 +368,21 @@ begin
|
|||
self.calcTargetPath( params );
|
||||
end;
|
||||
|
||||
function TMountedFileSourceProcessor.calcSourcePath(
|
||||
const mountedFS: TMountedFileSource;
|
||||
const targetFS: IFileSource;
|
||||
const realPath: String ): String;
|
||||
var
|
||||
mountPoint: TMountPoint;
|
||||
begin
|
||||
mountPoint:= mountedFS.getMountPointFromPath( realPath );
|
||||
if mountPoint <> nil then begin
|
||||
Result:= mountPoint.path
|
||||
end else begin
|
||||
Result:= GetParentDir( realPath );
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMountedFileSourceProcessor.consultOperation(
|
||||
var params: TFileSourceConsultParams);
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ uses
|
|||
uiCloudDriveConfig, uiCloudDriveUtil,
|
||||
uFile, uDisplayFile,
|
||||
uFileSource, uFileSourceOperationTypes, uFileSourceManager,
|
||||
uFileSourceWatcher, uMountedFileSource, uVfsModule,
|
||||
uFileSourceWatcher, uMountedFileSource, uVfsModule, uMultiArchiveFileSource,
|
||||
uDCUtils, uLng,
|
||||
uDarwinFSWatch, uDarwinSimpleFSWatch, uDarwinDC,
|
||||
uDarwinFile, uDarwinImage, uDarwinUtil,
|
||||
|
|
@ -100,6 +100,11 @@ type
|
|||
{ TiCloudDriveProcessor }
|
||||
|
||||
TiCloudDriveProcessor = class( TMountedFileSourceProcessor )
|
||||
protected
|
||||
function calcSourcePath(
|
||||
const mountedFS: TMountedFileSource;
|
||||
const targetFS: IFileSource;
|
||||
const realPath: String): String; override;
|
||||
public
|
||||
procedure consultOperation(var params: TFileSourceConsultParams); override;
|
||||
end;
|
||||
|
|
@ -137,6 +142,26 @@ var
|
|||
|
||||
{ TiCloudDriveProcessor }
|
||||
|
||||
function TiCloudDriveProcessor.calcSourcePath(
|
||||
const mountedFS: TMountedFileSource;
|
||||
const targetFS: IFileSource;
|
||||
const realPath: String): String;
|
||||
var
|
||||
mountPoint: TMountPoint;
|
||||
begin
|
||||
mountPoint:= mountedFS.getMountPointFromPath( realPath );
|
||||
{
|
||||
'%R' is usually not specified in TMultiArchiveFileSource
|
||||
this means that specifying subdir in MultiArchive/7z is not supported.
|
||||
therefore, it falls back to the base path of iCloud to indirectly
|
||||
achieve the effect of the subdir.
|
||||
}
|
||||
if (mountPoint<>nil) and targetFS.IsClass(TMultiArchiveFileSource) then
|
||||
Result:= uDCUtils.ReplaceTilde( iCloudDriveConfig.path.base )
|
||||
else
|
||||
Result:= inherited;
|
||||
end;
|
||||
|
||||
procedure TiCloudDriveProcessor.consultOperation( var params: TFileSourceConsultParams );
|
||||
|
||||
procedure confirmIfSeedFiles;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue