* Improved verbose and debug output while removing files

* Do not try to remove directories for cpuNone and osNone

git-svn-id: trunk@24724 -
This commit is contained in:
joost 2013-06-01 15:00:35 +00:00
parent 5ff7bb884e
commit ed5891f146

View File

@ -1373,7 +1373,8 @@ ResourceString
SInfoCleaningPackage = 'Cleaning package %s';
SInfoManifestPackage = 'Creating manifest for package %s';
SInfoCopyingFile = 'Copying file "%s" to "%s"';
SInfoDeletingFile = 'Deleting file "%s"';
SInfoDeletedFile = 'Deleted file "%s"';
SInfoRemovedDirectory = 'Removed directory "%s"';
SInfoSourceNewerDest = 'Source file "%s" (%s) is newer than destination "%s" (%s).';
SInfoDestDoesNotExist = 'Destination file "%s" does not exist.';
SInfoFallbackBuildmode = 'Buildmode not supported by package, falling back to one by one unit compilation';
@ -1419,6 +1420,9 @@ ResourceString
SDbgDependencyRecompiled = 'The unit %s where this unit depends on is recompiled';
SDbgPackageDepRecompiled = 'The package %s where this package depends on is recompiled';
SDbgTargetHasToBeCompiled = 'At least one of the targets in the package has to be compiled.';
SDbgDeletedFile = 'Recursively deleted file "%s"';
SDbgRemovedDirectory = 'Recursively removed directory "%s"';
// Help messages for usage
SValue = 'Value';
@ -4680,11 +4684,12 @@ end;
procedure TBuildEngine.SysDeleteFile(Const AFileName : String);
begin
Log(vlInfo,SInfoDeletingFile,[AFileName]);
if not FileExists(AFileName) then
Log(vldebug,SDbgFileDoesNotExist,[AFileName])
else If Not DeleteFile(AFileName) then
Error(SErrDeletingFile,[AFileName]);
Error(SErrDeletingFile,[AFileName])
else
Log(vlInfo,SInfoDeletedFile,[AFileName]);
end;
procedure TBuildEngine.SysDeleteDirectory(Const ADirectoryName: String);
@ -4694,7 +4699,9 @@ begin
else if not IsDirectoryEmpty(ADirectoryName) then
Log(vldebug,SDbgDirectoryNotEmpty,[ADirectoryName])
else If Not RemoveDir(ADirectoryName) then
Error(SErrRemovingDirectory,[ADirectoryName]);
Error(SErrRemovingDirectory,[ADirectoryName])
else
Log(vlInfo,SInfoRemovedDirectory,[ADirectoryName]);
end;
@ -4704,6 +4711,7 @@ procedure TBuildEngine.SysDeleteTree(Const ADirectoryName: String);
var
searchRec: TSearchRec;
SearchResult: longint;
s: string;
begin
result := true;
SearchResult := FindFirst(IncludeTrailingPathDelimiter(ADirectoryName)+AllFilesMask, faAnyFile+faSymLink, searchRec);
@ -4712,13 +4720,16 @@ procedure TBuildEngine.SysDeleteTree(Const ADirectoryName: String);
begin
if (searchRec.Name<>'.') and (searchRec.Name<>'..') then
begin
s := IncludeTrailingPathDelimiter(ADirectoryName)+searchRec.Name;
if (searchRec.Attr and faDirectory)=faDirectory then
begin
if not IntRemoveTree(IncludeTrailingPathDelimiter(ADirectoryName)+searchRec.Name) then
if not IntRemoveTree(s) then
result := false;
end
else if not DeleteFile(IncludeTrailingPathDelimiter(ADirectoryName)+searchRec.Name) then
result := False;
else if not DeleteFile(s) then
result := False
else
log(vldebug, SDbgDeletedFile, [s]);
end;
SearchResult := FindNext(searchRec);
end;
@ -4726,14 +4737,18 @@ procedure TBuildEngine.SysDeleteTree(Const ADirectoryName: String);
FindClose(searchRec);
end;
if not RemoveDir(ADirectoryName) then
result := false;
result := false
else
log(vldebug, SDbgRemovedDirectory, [ADirectoryName]);
end;
begin
if not DirectoryExists(ADirectoryName) then
Log(vldebug,SDbgDirectoryDoesNotExist,[ADirectoryName])
else If Not IntRemoveTree(ADirectoryName) then
Error(SErrRemovingDirectory,[ADirectoryName]);
Error(SErrRemovingDirectory,[ADirectoryName])
else
Log(vlInfo,SInfoRemovedDirectory,[ADirectoryName]);
end;
@ -6524,8 +6539,8 @@ begin
// being renamed and such. See also bug 19655
DirectoryList := TStringList.Create;
try
for ACPU:=low(TCpu) to high(TCpu) do
for AOS:=low(TOS) to high(TOS) do
for ACPU:=low(TCpu) to high(TCpu) do if ACPU<>cpuNone then
for AOS:=low(TOS) to high(TOS) do if AOS<>osNone then
begin
DirectoryList.Add(ExtractFileDir(APackage.GetUnitsOutputDir(ACPU,AOS)));
DirectoryList.Add(ExtractFileDir(APackage.GetBinOutputDir(ACPU,AOS)));