mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 22:31:10 +02:00
IDE/lazbuild: rename/delete lazarus.exe backups: show failures
git-svn-id: branches/fixes_1_4@48578 -
This commit is contained in:
parent
915a4294d0
commit
86596fb5ca
@ -54,10 +54,10 @@ uses
|
||||
CodeToolManager,
|
||||
// IDEIntf
|
||||
LazIDEIntf, IDEMsgIntf, IDEHelpIntf, IDEImagesIntf, IDEWindowIntf, IDEDialogs,
|
||||
PackageIntf, IDEExternToolIntf,
|
||||
PackageIntf, IDEExternToolIntf, IDEOptionsIntf,
|
||||
// IDE
|
||||
LazarusIDEStrConsts, TransferMacros, LazConf, IDEProcs, DialogProcs,
|
||||
MainBar, ExtToolEditDlg, EnvironmentOpts,
|
||||
MainBar, EnvironmentOpts,
|
||||
ApplicationBundle, ModeMatrixOpts, CompilerOptions, BuildProfileManager,
|
||||
GenericListEditor, GenericCheckList, PackageSystem, PackageDefs;
|
||||
|
||||
@ -746,15 +746,17 @@ begin
|
||||
// always delete the lazarus.new exe, so that users/startlazarus are not
|
||||
// confused which one is the newest
|
||||
if FileExistsUTF8(AltFilename) then begin
|
||||
if DeleteFileUTF8(AltFilename) then
|
||||
debugln(['Note: deleted file "',AltFilename,'"'])
|
||||
else
|
||||
debugln(['WARNING: unable to delete file "',AltFilename,'"']);
|
||||
case DeleteFileInteractive(AltFilename,[mbIgnore]) of
|
||||
mrIgnore:
|
||||
debugln(['Warning: (lazarus) unable to delete file "',AltFilename,'"']);
|
||||
mrOk:
|
||||
debugln(['Note: (lazarus) deleted file "',AltFilename,'"']);
|
||||
end;
|
||||
end;
|
||||
|
||||
// try to rename the old exe
|
||||
BackupFilename:=GetBackupExeFilename(fTargetFilename);
|
||||
if FileExistsUTF8(BackupFilename) then
|
||||
if FileExistsUTF8(BackupFilename) then begin
|
||||
if DeleteFileUTF8(BackupFilename) then begin
|
||||
debugln(['Note: deleted backup "',BackupFilename,'"']);
|
||||
end else begin
|
||||
@ -762,23 +764,30 @@ begin
|
||||
// => try to backup the backup
|
||||
Backup2Filename:=LeftStr(fTargetFilename,length(fTargetFilename)-length(Ext))+'.old2'+Ext;
|
||||
if FileExistsUTF8(Backup2Filename) then begin
|
||||
if DeleteFileUTF8(Backup2Filename) then
|
||||
case DeleteFileInteractive(Backup2Filename) of
|
||||
mrOk:
|
||||
debugln(['Note: deleted backup "',Backup2Filename,'"'])
|
||||
else
|
||||
debugln(['WARNING: unable to delete old backup file "'+Backup2Filename+'"']);
|
||||
end;
|
||||
end;
|
||||
if not FileExistsUTF8(Backup2Filename) then begin
|
||||
if RenameFileUTF8(BackupFilename,Backup2Filename) then
|
||||
case RenameFileWithErrorDialogs(BackupFilename,Backup2Filename) of
|
||||
mrOk:
|
||||
debugln(['Note: renamed old backup file "'+BackupFilename+'" to "',Backup2Filename,'"'])
|
||||
else
|
||||
debugln(['WARNING: unable to rename old backup file "'+BackupFilename+'" to "',Backup2Filename,'"']);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if not FileExistsUTF8(BackupFilename) then begin
|
||||
if RenameFileUTF8(fTargetFilename,BackupFilename) then
|
||||
case RenameFileWithErrorDialogs(fTargetFilename,BackupFilename) of
|
||||
mrOk:
|
||||
debugln(['Note: renamed file "'+fTargetFilename+'" to "',BackupFilename,'"'])
|
||||
else
|
||||
debugln(['WARNING: unable to rename file "'+fTargetFilename+'" to "',BackupFilename,'"']);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if (not (blfReplaceExe in Flags)) and FileExistsUTF8(fTargetFilename) then
|
||||
|
@ -65,9 +65,9 @@ var
|
||||
|
||||
function BackupFileInteractive(const Filename: string): TModalResult;
|
||||
function RenameFileWithErrorDialogs(const SrcFilename, DestFilename: string;
|
||||
ExtraButtons: TMsgDlgButtons): TModalResult;
|
||||
ExtraButtons: TMsgDlgButtons = []): TModalResult;
|
||||
function CopyFileWithErrorDialogs(const SrcFilename, DestFilename: string;
|
||||
ExtraButtons: TMsgDlgButtons): TModalResult;
|
||||
ExtraButtons: TMsgDlgButtons = []): TModalResult;
|
||||
function LoadCodeBuffer(out ACodeBuffer: TCodeBuffer; const AFilename: string;
|
||||
Flags: TLoadBufferFlags; ShowAbort: boolean): TModalResult;
|
||||
function SaveCodeBuffer(ACodeBuffer: TCodeBuffer): TModalResult;
|
||||
|
Loading…
Reference in New Issue
Block a user