IDE: ignore write errors for .po and Makefiles if directory is readonly

git-svn-id: trunk@12718 -
This commit is contained in:
mattias 2007-11-03 16:56:23 +00:00
parent ee3d4895ef
commit c1df9e4739
2 changed files with 23 additions and 3 deletions

View File

@ -2703,7 +2703,12 @@ begin
RSTOutputDirectory:=AppendPathDelim(APackage.GetPOOutDirectory);
// find all .rst files in package output directory
PkgOutputDirectory:=AppendPathDelim(APackage.GetOutputDirectory);
if not DirectoryIsWritableCached(RSTOutputDirectory) then begin
// this package is read only
DebugLn(['TLazPackageGraph.ConvertPackageRSTFiles skipping read only directory '+RSTOutputDirectory]);
exit(mrOK);
end;
if not ConvertRSTFiles(PkgOutputDirectory,RSTOutputDirectory) then begin
DebugLn(['TLazPackageGraph.ConvertPackageRSTFiles FAILED: PkgOutputDirectory=',PkgOutputDirectory,' RSTOutputDirectory=',RSTOutputDirectory]);
exit(mrCancel);

View File

@ -1336,8 +1336,16 @@ begin
CodeBuffer:=CodeToolBoss.LoadFile(MakefileFPCFilename,true,true);
if CodeBuffer=nil then begin
CodeBuffer:=CodeToolBoss.CreateFile(MakefileFPCFilename);
if CodeBuffer=nil then begin
if not DirectoryIsWritableCached(ExtractFilePath(MakefileFPCFilename))
then begin
// the package source is read only => no problem
exit(mrOk);
end;
exit(mrCancel);
end;
end;
if CompareTextIgnoringSpace(CodeBuffer.Source,s,false)=0 then begin
// Makefile.fpc not changed
Result:=mrOk;
@ -1347,7 +1355,14 @@ begin
//debugln('TPkgManager.DoWriteMakefile MakefileFPCFilename="',MakefileFPCFilename,'"');
Result:=SaveCodeBufferToFile(CodeBuffer,MakefileFPCFilename);
if Result<>mrOk then exit;
if Result<>mrOk then begin
if not DirectoryIsWritableCached(ExtractFilePath(MakefileFPCFilename)) then
begin
// the package source is read only => no problem
Result:=mrOk;
end;
exit;
end;
// call fpcmake to create the Makefile
FPCMakeTool:=TIDEExternalToolOptions.Create;