mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 20:29:23 +02:00
* Removed error thrown when trying to build help index if the documentation is installed on a read only file system and tries to store the index file in current directory. (Closes Debian bug#662814)
git-svn-id: trunk@21990 -
This commit is contained in:
parent
944189f046
commit
f6deb01295
@ -132,13 +132,48 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure THelpFilesDialog.HandleEvent(var Event: TEvent);
|
procedure THelpFilesDialog.HandleEvent(var Event: TEvent);
|
||||||
|
function StoreHtmlIndexFile(const FileName: string; LS: PFPHTMLFileLinkScanner;var Re: Word; SilentFails: Boolean): Boolean;
|
||||||
|
var
|
||||||
|
BS: PBufStream;
|
||||||
|
begin
|
||||||
|
if ExistsFile(FileName) then
|
||||||
|
if ConfirmBox(FormatStrStr(msg_filealreadyexistsoverwrite,FileName),nil,true)<>cmYes then
|
||||||
|
Re:=cmCancel;
|
||||||
|
if Re<>cmCancel then
|
||||||
|
begin
|
||||||
|
PushStatus(FormatStrStr(msg_storinghtmlindexinfile,FileName));
|
||||||
|
New(BS, Init(FileName, stCreate, 4096));
|
||||||
|
if Assigned(BS)=false then
|
||||||
|
begin
|
||||||
|
if not SilentFails then
|
||||||
|
begin
|
||||||
|
ErrorBox(FormatStrStr(msg_cantcreatefile,FileName),nil);
|
||||||
|
end;
|
||||||
|
Re:=cmCancel;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
LS^.StoreDocuments(BS^);
|
||||||
|
if BS^.Status<>stOK then
|
||||||
|
begin
|
||||||
|
if not SilentFails then
|
||||||
|
begin
|
||||||
|
ErrorBox(FormatStrInt(msg_errorstoringindexdata,BS^.Status),nil);
|
||||||
|
end;
|
||||||
|
Re:=cmCancel;
|
||||||
|
end;
|
||||||
|
Dispose(BS, Done);
|
||||||
|
end;
|
||||||
|
PopStatus;
|
||||||
|
end;
|
||||||
|
StoreHtmlIndexFile := Re <> cmCancel;
|
||||||
|
end;
|
||||||
var I: integer;
|
var I: integer;
|
||||||
D: PFileDialog;
|
D: PFileDialog;
|
||||||
FileName: string;
|
FileName: string;
|
||||||
Re: word;
|
Re: word;
|
||||||
S: string;
|
S: string;
|
||||||
LS: PFPHTMLFileLinkScanner;
|
LS: PFPHTMLFileLinkScanner;
|
||||||
BS: PBufStream;
|
|
||||||
begin
|
begin
|
||||||
case Event.What of
|
case Event.What of
|
||||||
evKeyDown :
|
evKeyDown :
|
||||||
@ -193,30 +228,15 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FileName:=DirAndNameOf(FileName)+HTMLIndexExt;
|
FileName:=DirAndNameOf(FileName)+HTMLIndexExt;
|
||||||
if ExistsFile(FileName) then
|
if not StoreHtmlIndexFile(FileName, LS, Re, True) then
|
||||||
if ConfirmBox(FormatStrStr(msg_filealreadyexistsoverwrite,FileName),nil,true)<>cmYes then
|
|
||||||
Re:=cmCancel;
|
|
||||||
if Re<>cmCancel then
|
|
||||||
begin
|
begin
|
||||||
PushStatus(FormatStrStr(msg_storinghtmlindexinfile,FileName));
|
Re:=ConfirmBox(FormatStrStr('Could not create "%s", try creating it in local dir?', FileName),nil,true);
|
||||||
New(BS, Init(FileName, stCreate, 4096));
|
FileName := GetCurDir + NameAndExtOf(FileName);
|
||||||
if Assigned(BS)=false then
|
if Re = cmYes then
|
||||||
begin
|
begin
|
||||||
ErrorBox(FormatStrStr(msg_cantcreatefile,FileName),nil);
|
StoreHtmlIndexFile(FileName, LS, Re, False);
|
||||||
Re:=cmCancel;
|
end;
|
||||||
end
|
end
|
||||||
else
|
|
||||||
begin
|
|
||||||
LS^.StoreDocuments(BS^);
|
|
||||||
if BS^.Status<>stOK then
|
|
||||||
begin
|
|
||||||
ErrorBox(FormatStrInt(msg_errorstoringindexdata,BS^.Status),nil);
|
|
||||||
Re:=cmCancel;
|
|
||||||
end;
|
|
||||||
Dispose(BS, Done);
|
|
||||||
end;
|
|
||||||
PopStatus;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
Dispose(LS, Done);
|
Dispose(LS, Done);
|
||||||
PopStatus;
|
PopStatus;
|
||||||
|
@ -1615,7 +1615,7 @@ begin
|
|||||||
OK:=Assigned(LS);
|
OK:=Assigned(LS);
|
||||||
if OK then
|
if OK then
|
||||||
begin
|
begin
|
||||||
LS^.SetBaseDir(DirOf(IndexFileName));
|
{LS^.SetBaseDir(DirOf(IndexFileName)); already set by LoadDocuments to real base dire stored into htx file. This allows storing toc file in current dir in case doc installation dir is read only.}
|
||||||
for I:=0 to LS^.GetDocumentCount-1 do
|
for I:=0 to LS^.GetDocumentCount-1 do
|
||||||
begin
|
begin
|
||||||
TLI:=TopicLinks^.AddItem(LS^.GetDocumentURL(I));
|
TLI:=TopicLinks^.AddItem(LS^.GetDocumentURL(I));
|
||||||
|
Loading…
Reference in New Issue
Block a user