mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: apply TFileSource.GetFileName()
This commit is contained in:
parent
ca378ab948
commit
2958b138f9
6 changed files with 21 additions and 11 deletions
|
|
@ -180,6 +180,7 @@ begin
|
|||
@ShowCompareFilesUI,
|
||||
Thread,
|
||||
fsohmCopy,
|
||||
(FileSource as IFileSource),
|
||||
TargetPath,
|
||||
FStatistics);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ begin
|
|||
@ShowCompareFilesUI,
|
||||
Thread,
|
||||
fsohmMove,
|
||||
FileSource,
|
||||
TargetPath,
|
||||
FStatistics);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,14 @@ interface
|
|||
uses
|
||||
Classes, SysUtils, uDescr, uLog, uGlobs, DCOSUtils,
|
||||
uFile,
|
||||
uFileSource,
|
||||
uFileSourceOperation,
|
||||
uFileSourceOperationOptions,
|
||||
uFileSourceOperationUI,
|
||||
uFileSourceCopyOperation,
|
||||
uFileSourceTreeBuilder;
|
||||
|
||||
function ApplyRenameMask(aFile: TFile; NameMask: String; ExtMask: String): String; overload;
|
||||
function ApplyRenameMask(FileSource: IFileSource; aFile: TFile; NameMask: String; ExtMask: String): String; overload;
|
||||
procedure FillAndCount(Files: TFiles;
|
||||
CountDirs: Boolean;
|
||||
ExcludeRootDir: Boolean;
|
||||
|
|
@ -60,6 +61,7 @@ type
|
|||
FMode: TFileSystemOperationHelperMode;
|
||||
FBuffer: Pointer;
|
||||
FBufferSize: LongWord;
|
||||
FFileSource: IFileSource;
|
||||
FRootTargetPath: String;
|
||||
FRenameMask: String;
|
||||
FRenameNameMask, FRenameExtMask: String;
|
||||
|
|
@ -151,6 +153,7 @@ type
|
|||
|
||||
OperationThread: TThread;
|
||||
Mode: TFileSystemOperationHelperMode;
|
||||
FileSource: IFileSource;
|
||||
TargetPath: String;
|
||||
StartingStatistics: TFileSourceCopyOperationStatistics);
|
||||
destructor Destroy; override;
|
||||
|
|
@ -177,7 +180,7 @@ implementation
|
|||
|
||||
uses
|
||||
uDebug, uDCUtils, uOSUtils, DCStrUtils, FileUtil, uFindEx, DCClassesUtf8, uFileProcs, uLng,
|
||||
DCBasicTypes, uFileSource, uFileSystemFileSource, uFileProperty, uAdministrator,
|
||||
DCBasicTypes, uFileSystemFileSource, uFileProperty, uAdministrator,
|
||||
StrUtils, DCDateTimeUtils, uShowMsg, Forms, LazUTF8, uHash, uFileCopyEx, SysConst,
|
||||
Math, DateUtils
|
||||
{$IFDEF UNIX}
|
||||
|
|
@ -188,13 +191,16 @@ uses
|
|||
const
|
||||
HASH_TYPE = HASH_BEST;
|
||||
|
||||
function ApplyRenameMask(aFile: TFile; NameMask: String; ExtMask: String): String; overload;
|
||||
function ApplyRenameMask(FileSource: IFileSource; aFile: TFile; NameMask: String; ExtMask: String): String; overload;
|
||||
var
|
||||
filename: String;
|
||||
begin
|
||||
filename:= FileSource.GetFileName( aFile );
|
||||
// Only change name for files.
|
||||
if aFile.IsDirectory or aFile.IsLink then
|
||||
Result := aFile.Name
|
||||
Result := filename
|
||||
else
|
||||
Result := ApplyRenameMask(aFile.Name, NameMask, ExtMask);
|
||||
Result := ApplyRenameMask(filename, NameMask, ExtMask);
|
||||
end;
|
||||
|
||||
procedure FillAndCount(Files: TFiles; CountDirs: Boolean; ExcludeRootDir: Boolean;
|
||||
|
|
@ -399,6 +405,7 @@ constructor TFileSystemOperationHelper.Create(
|
|||
UpdateStatisticsFunction: TUpdateStatisticsFunction;
|
||||
ShowCompareFilesUIFunction: TShowCompareFilesUIFunction;
|
||||
OperationThread: TThread; Mode: TFileSystemOperationHelperMode;
|
||||
FileSource: IFileSource;
|
||||
TargetPath: String; StartingStatistics: TFileSourceCopyOperationStatistics);
|
||||
begin
|
||||
AskQuestion := AskQuestionFunction;
|
||||
|
|
@ -423,6 +430,7 @@ begin
|
|||
FDirExistsOption := fsoodeNone;
|
||||
FSetPropertyError := fsoospeNone;
|
||||
FRootTargetPath := TargetPath;
|
||||
FFileSource := FileSource;
|
||||
FRenameMask := '';
|
||||
FStatistics := StartingStatistics;
|
||||
FRenamingFiles := False;
|
||||
|
|
@ -1090,9 +1098,9 @@ begin
|
|||
if FRenamingRootDir and (aFile = FRootDir) then
|
||||
TargetName := CurrentTargetPath + FRenameMask
|
||||
else if FRenamingFiles then
|
||||
TargetName := CurrentTargetPath + ApplyRenameMask(aFile, FRenameNameMask, FRenameExtMask)
|
||||
TargetName := CurrentTargetPath + ApplyRenameMask(FFileSource, aFile, FRenameNameMask, FRenameExtMask)
|
||||
else
|
||||
TargetName := CurrentTargetPath + aFile.Name;
|
||||
TargetName := CurrentTargetPath + FFileSource.GetFileName(aFile);
|
||||
|
||||
with FStatistics do
|
||||
begin
|
||||
|
|
@ -1437,7 +1445,7 @@ begin
|
|||
{$ENDIF}
|
||||
|
||||
if (aNode.TheFile.Size > GetDiskMaxFileSize(ExtractFileDir(AbsoluteTargetFileName))) then
|
||||
case AskQuestion('', Format(rsMsgFileSizeTooBig, [aNode.TheFile.Name]),
|
||||
case AskQuestion('', Format(rsMsgFileSizeTooBig, [FFileSource.GetFileName(aNode.TheFile)]),
|
||||
[fsourSkip, fsourAbort],
|
||||
fsourSkip, fsourAbort) of
|
||||
fsourSkip:
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ begin
|
|||
if FRenamingRootDir and (aFile = FRootDir) then
|
||||
TargetName := FRenameMask
|
||||
else if FRenamingFiles then
|
||||
TargetName := ApplyRenameMask(aFile, FRenameNameMask, FRenameExtMask)
|
||||
TargetName := ApplyRenameMask(FWfxPluginFileSource, aFile, FRenameNameMask, FRenameExtMask)
|
||||
else
|
||||
TargetName := aFile.Name;
|
||||
|
||||
|
|
|
|||
|
|
@ -2994,7 +2994,7 @@ begin
|
|||
if FileSource is TSearchResultFileSource then
|
||||
SetFileSystemPath(Self, aFile.FullPath)
|
||||
else
|
||||
CurrentPath := CurrentPath + IncludeTrailingPathDelimiter(aFile.Name);
|
||||
CurrentPath := CurrentPath + IncludeTrailingPathDelimiter(FileSource.GetFileName(aFile));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -3185,7 +3185,7 @@ begin
|
|||
if Files.Count > 1 then
|
||||
Result := Format(sLngMulti, [Files.Count])
|
||||
else
|
||||
Result := Format(sLngOne, [Files[0].Name]);
|
||||
Result := Format(sLngOne, [ActiveFrame.FileSource.GetFileName(Files[0])]);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.miHotAddOrConfigClick(Sender: TObject);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue