From b2798f75be4aa30de51daa2ab97915f808c038a3 Mon Sep 17 00:00:00 2001 From: marco Date: Sun, 28 Mar 2021 12:48:20 +0000 Subject: [PATCH] * more fixes from serbod repo. Make paths relative. git-svn-id: trunk@49071 - --- packages/chm/src/chmfilewriter.pas | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/chm/src/chmfilewriter.pas b/packages/chm/src/chmfilewriter.pas index cd0c1ec4a3..e83bdc9d50 100644 --- a/packages/chm/src/chmfilewriter.pas +++ b/packages/chm/src/chmfilewriter.pas @@ -1190,8 +1190,8 @@ begin Writer.FullTextSearch := MakeSearchable; Writer.HasBinaryTOC := MakeBinaryTOC; Writer.HasBinaryIndex := MakeBinaryIndex; - Writer.IndexName := ExtractFileName(IndexFileName); - Writer.TocName := ExtractFileName(TableOfContentsFileName); + Writer.IndexName := IndexFileName; + Writer.TocName := TableOfContentsFileName; Writer.ReadmeMessage := ReadmeMessage; Writer.DefaultWindow := FDefaultWindow; Writer.LocaleID := FLocaleID; @@ -1231,16 +1231,19 @@ begin end; procedure TChmProject.LoadSitemaps; +var + FullFileName: string; // #IDXHDR (merged files) goes into the system file, and need to keep TOC sitemap around begin if FTableOfContentsFileName<>'' then begin - if fileexists(FTableOfContentsFileName) then + FullFileName := IncludeTrailingPathDelimiter(ProjectDir()) + ExtractFileName(FTableOfContentsFileName); + if FileExists(FullFileName) then begin FreeAndNil(FTocStream); FTocStream:=TMemoryStream.Create; try - FTocStream.loadfromfile(FTableOfContentsFilename); + FTocStream.loadfromfile(FullFileName); //writeln(ftableofcontentsfilename, ' ' ,ftocstream.size); FTocStream.Position:=0; FreeAndNil(FToc); @@ -1257,18 +1260,19 @@ begin else error(chmerror,'Can''t find TOC file'+FTableOfContentsFileName); end; - if FIndexFileName<>'' then + FullFileName := IncludeTrailingPathDelimiter(ProjectDir()) + ExtractFileName(FIndexFileName); + if FileExists(FullFileName) then begin if fileexists(FIndexFileName) then begin FreeAndNil(FIndexStream); FIndexStream:=TMemoryStream.Create; try - FIndexStream.LoadFromFile(FIndexFileName); + FIndexStream.LoadFromFile(FullFileName); FIndexStream.Position:=0; FreeAndNil(FIndex); FIndex:=TChmSiteMap.Create(stindex); - FIndex.loadfromfile(FIndexFileName); + FIndex.loadfromfile(FullFileName); Error(chmnote,'Index items:'+inttostr(findex.Items.count)); except on e: Exception do