mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 22:09:45 +02:00
* Improve CHM versioning, now that a compiler is added. Main chm version is in chmbase
git-svn-id: trunk@19703 -
This commit is contained in:
parent
816953990d
commit
0d562f04ff
packages/chm/src
@ -26,6 +26,9 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
const
|
||||
CHMPackageVersion = '2.6.0'; // to be put in readme
|
||||
|
||||
type
|
||||
{$PACKRECORDS C}
|
||||
|
@ -25,6 +25,9 @@ program chmcmd;
|
||||
uses
|
||||
Classes, Sysutils, chmfilewriter, GetOpts;
|
||||
|
||||
Const
|
||||
CHMCMDVersion = '2.6.0';
|
||||
|
||||
Procedure Usage;
|
||||
|
||||
begin
|
||||
@ -41,7 +44,6 @@ begin
|
||||
Halt(1);
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
theopts : array[1..6] of TOption;
|
||||
|
||||
@ -117,6 +119,7 @@ var
|
||||
begin
|
||||
ishhp:=uppercase(extractfileext(name))='.HHP';
|
||||
Project := TChmProject.Create;
|
||||
Project.ReadMeMessage:='Compiled by CHMCmd '+CHMCMDVersion;
|
||||
if ishhp then
|
||||
begin
|
||||
xmlname:=changefileext(name,'.hhp.xml');
|
||||
|
@ -61,7 +61,8 @@ type
|
||||
fAllowedExtensions: TStringList;
|
||||
fTotalFileList : TAvlTree;
|
||||
FSpareString : TStringIndex;
|
||||
FBasePath : String; // location of the .hhp file. Needed to resolve relative paths
|
||||
FBasePath : String; // location of the .hhp file. Needed to resolve relative paths
|
||||
FReadmeMessage : String; // readme message
|
||||
protected
|
||||
function GetData(const DataName: String; out PathInChm: String; out FileName: String; var Stream: TStream): Boolean;
|
||||
procedure LastFileAdded(Sender: TObject);
|
||||
@ -101,6 +102,7 @@ type
|
||||
property OnError : TChmErrorCB read FOnError write FOnError;
|
||||
property DefaultWindow : String read FDefaultWindow write FDefaultWindow;
|
||||
property ScanHtmlContents : Boolean read fScanHtmlContents write fScanHtmlContents;
|
||||
property ReadmeMessage : String read FReadmeMessage write FReadmeMessage;
|
||||
property AllowedExtensions : TStringList read FAllowedExtensions;
|
||||
end;
|
||||
|
||||
@ -1052,7 +1054,7 @@ begin
|
||||
Writer.HasBinaryIndex := MakeBinaryIndex;
|
||||
Writer.IndexName := IndexFileName;
|
||||
Writer.TocName := TableOfContentsFileName;
|
||||
|
||||
Writer.ReadmeMessage := ReadmeMessage;
|
||||
for i:=0 to files.count-1 do
|
||||
begin
|
||||
nd:=TChmContextNode(files.objects[i]);
|
||||
|
@ -78,6 +78,7 @@ Type
|
||||
HeaderSuffix: TITSFHeaderSuffix; //contains the offset of CONTENTSection0 from zero
|
||||
HeaderSection0: TITSPHeaderPrefix;
|
||||
HeaderSection1: TITSPHeader; // DirectoryListings header
|
||||
FReadmeMessage : String;
|
||||
// DirectoryListings
|
||||
// CONTENT Section 0 (section 1 is contained in section 0)
|
||||
// EOF
|
||||
@ -125,6 +126,7 @@ Type
|
||||
property OnLastFile: TNotifyEvent read FOnLastFile write FOnLastFile;
|
||||
property OutStream: TStream read FOutStream;
|
||||
property TempRawStream: TStream read FTempStream write SetTempRawStream;
|
||||
property ReadmeMessage : String read fReadmeMessage write fReadmeMessage;
|
||||
//property LocaleID: dword read ITSFHeader.LanguageID write ITSFHeader.LanguageID;
|
||||
end;
|
||||
|
||||
@ -525,7 +527,7 @@ begin
|
||||
end;
|
||||
|
||||
procedure TITSFWriter.WriteREADMEFile;
|
||||
const DISCLAIMER_STR = 'This archive was not made by the MS HTML Help Workshop(r)(tm) program.';
|
||||
const DISCLAIMER_STR = 'This archive was not made by the MS HTML Help Workshop(r)(tm) program, but by Free Pascal''s chm package '+chmpackageversion+'.'#13#10;
|
||||
var
|
||||
Entry: TFileEntryRec;
|
||||
begin
|
||||
@ -533,6 +535,8 @@ begin
|
||||
Entry.Compressed := False;
|
||||
Entry.DecompressedOffset := FSection0.Position;
|
||||
FSection0.Write(DISCLAIMER_STR, SizeOf(DISCLAIMER_STR));
|
||||
if length(FReadmeMessage)>0 then
|
||||
FSection0.Write(FReadmeMessage[1], length(FReadmeMessage));
|
||||
Entry.DecompressedSize := FSection0.Position - Entry.DecompressedOffset;
|
||||
Entry.Path := '/';
|
||||
Entry.Name := '_#_README_#_'; //try to use a name that won't conflict with normal names
|
||||
|
Loading…
Reference in New Issue
Block a user