ADD: Copy/Skip files with overlong name

This commit is contained in:
Alexander Koblov 2016-08-19 21:50:17 +00:00
commit 739bbc905c
6 changed files with 38 additions and 12 deletions

View file

@ -318,6 +318,7 @@ procedure SetValue(var anArray: TDynamicStringArray; Key, NewValue: String);
procedure SetValue(var anArray: TDynamicStringArray; Key: String; NewValue: Boolean);
function ShortcutsToText(const Shortcuts: TDynamicStringArray): String;
function GetDateTimeInStrEZSortable(DateTime:TDateTime):string;
function WrapTextSimple(const S: String; MaxCol: Integer): String;
implementation
@ -1190,8 +1191,19 @@ begin
result:=Format('%d-%2.2d-%2.2d@%2.2d-%2.2d-%2.2d', [MyYear, MyMonth, MyDay, MyHour, MyMin, MySec]);
end;
function WrapTextSimple(const S: String; MaxCol: Integer): String;
var
Temp: String;
begin
Temp:= S;
Result:= EmptyStr;
while (Length(Temp) > 0) do
begin
Result:= Result + Copy(Temp, 1, MaxCol) + LineEnding;
Delete(Temp, 1, MaxCol);
end;
SetLength(Result, Length(Result) - Length(LineEnding));
end;
end.

View file

@ -77,6 +77,7 @@ type
FAutoRenameItSelf: Boolean;
FCorrectSymLinks: Boolean;
FCopyAttributesOptions: TCopyAttributesOptions;
FMaxPathOption: TFileSourceOperationUIResponse;
FFileExistsOption: TFileSourceOperationOptionFileExists;
FDirExistsOption: TFileSourceOperationOptionDirectoryExists;
@ -795,10 +796,11 @@ function TFileSystemOperationHelper.ProcessNode(aFileTreeNode: TFileTreeNode;
CurrentTargetPath: String): Boolean;
var
aFile: TFile;
ProcessedOk: Boolean;
TargetName: String;
ProcessedOk: Boolean;
CurrentFileIndex: Integer;
CurrentSubNode: TFileTreeNode;
AskResult: TFileSourceOperationUIResponse;
begin
Result := True;
@ -848,18 +850,27 @@ begin
// Check MAX_PATH
if Length(TargetName) > MAX_PATH - 1 then
begin
case AskQuestion(Format(rsMsgFilePathOverMaxPath, [Length(TargetName), MAX_PATH - 1, '']), '',
[fsourAbort, fsourSkip], fsourAbort, fsourSkip) of
fsourAbort:
AbortOperation();
else
if FMaxPathOption <> fsourInvalid then
AskResult := FMaxPathOption
else begin
AskResult := AskQuestion(Format(rsMsgFilePathOverMaxPath,
[Length(TargetName), MAX_PATH - 1, LineEnding + WrapTextSimple(TargetName, 100) + LineEnding]), '',
[fsourIgnore, fsourSkip, fsourAbort, fsourIgnoreAll, fsourSkipAll], fsourIgnore, fsourSkip);
end;
case AskResult of
fsourAbort: AbortOperation();
fsourSkip,
fsourSkipAll:
begin
Result := False;
FMaxPathOption := fsourSkip;
CountStatistics(CurrentSubNode);
AppProcessMessages;
CheckOperationState;
Continue;
end;
fsourIgnore: ;
fsourIgnoreAll: FMaxPathOption := fsourIgnore;
end;
end;

View file

@ -35,13 +35,13 @@ const
(msmbOK, msmbOK, msmbNo, msmbYes, msmbCancel, msmbNone, msmbAppend, msmbResume,
msmbCopyInto, msmbCopyIntoAll, msmbOverwrite, msmbOverwriteAll, msmbOverwriteOlder,
msmbOverwriteSmaller, msmbOverwriteLarger, msmbAutoRenameSource, msmbRenameSource,
msmbSkip, msmbSkipAll, msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
msmbSkip, msmbSkipAll, msmbIgnore, msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
ResultToResponse: array[TMyMsgResult] of TFileSourceOperationUIResponse =
(fsourOk, fsourNo, fsourYes, fsourCancel, fsourNone, fsourAppend, fsourResume,
fsourCopyInto, fsourCopyIntoAll, fsourOverwrite, fsourOverwriteAll, fsourOverwriteOlder,
fsourOverwriteSmaller, fsourOverwriteLarger, fsourAutoRenameSource, fsourRenameSource,
fsourSkip, fsourSkipAll, fsourIgnoreAll, fsourAll, fsourRetry, fsourAbort);
fsourSkip, fsourSkipAll, fsourIgnore, fsourIgnoreAll, fsourAll, fsourRetry, fsourAbort);
constructor TFileSourceOperationMessageBoxesUI.Create;
begin

View file

@ -29,6 +29,7 @@ type
fsourRenameSource,
fsourSkip,
fsourSkipAll,
fsourIgnore,
fsourIgnoreAll,
fsourAll,
fsourRetry,

View file

@ -25,13 +25,13 @@ type
mmrAppend, mmrResume, mmrCopyInto, mmrCopyIntoAll,
mmrOverwrite, mmrOverwriteAll, mmrOverwriteOlder,
mmrOverwriteSmaller, mmrOverwriteLarger, mmrAutoRenameSource, mmrRenameSource,
mmrSkip, mmrSkipAll, mmrIgnoreAll, mmrAll, mmrRetry, mmrAbort);
mmrSkip, mmrSkipAll, mmrIgnore, mmrIgnoreAll, mmrAll, mmrRetry, mmrAbort);
TMyMsgButton=(msmbOK, msmbNo, msmbYes, msmbCancel, msmbNone,
msmbAppend, msmbResume, msmbCopyInto, msmbCopyIntoAll,
msmbOverwrite, msmbOverwriteAll, msmbOverwriteOlder,
msmbOverwriteSmaller, msmbOverwriteLarger, msmbAutoRenameSource, msmbRenameSource,
msmbSkip, msmbSkipAll, msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
msmbSkip, msmbSkipAll, msmbIgnore, msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
{ TDialogMainThread }
@ -721,6 +721,7 @@ begin
cLngButton[msmbRenameSource] := rsDlgButtonRename;
cLngButton[msmbSkip] := rsDlgButtonSkip;
cLngButton[msmbSkipAll] := rsDlgButtonSkipAll;
cLngButton[msmbIgnore] := rsDlgButtonIgnore;
cLngButton[msmbIgnoreAll] := rsDlgButtonIgnoreAll;
cLngButton[msmbAll] := rsDlgButtonAll;
cLngButton[msmbRetry] := rsDlgButtonRetry;

View file

@ -310,6 +310,7 @@ resourcestring
rsDlgButtonAutoRenameSource = 'A&uto-rename source files';
rsDlgButtonSkip = '&Skip';
rsDlgButtonSkipAll = 'S&kip All';
rsDlgButtonIgnore = 'Ig&nore';
rsDlgButtonIgnoreAll = 'I&gnore All';
rsDlgButtonAll = 'A&ll';
rsDlgButtonRetry = 'Re&try';