To v1.2.7.0

ReadMe now bundled as resource

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5731 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-30 08:51:14 +00:00
parent 51c5b20239
commit e109947a5f
4 changed files with 36 additions and 5 deletions

View File

@@ -717,6 +717,7 @@ object mainform: Tmainform
VersionCountLimit = 1000000 VersionCountLimit = 1000000
DownloadCountLimit = 10000000 DownloadCountLimit = 10000000
ZipfileName = 'updatepack.zip' ZipfileName = 'updatepack.zip'
WorkingMode = lauUpdate
ShortCut.ShortcutName = 'MyShortcutName' ShortCut.ShortcutName = 'MyShortcutName'
ShortCut.Category = scAudioVideo ShortCut.Category = scAudioVideo
Left = 424 Left = 424

View File

@@ -38,7 +38,8 @@ interface
uses uses
Classes, SysUtils, LazUTF8, LazFileUtils, FileUtil, Forms, Controls, Dialogs, Classes, SysUtils, LazUTF8, LazFileUtils, FileUtil, Forms, Controls, Dialogs,
Buttons, Menus, StdCtrls, EditBtn, Spin, ComCtrls, ulazautoupdate, inifiles, Buttons, Menus, StdCtrls, EditBtn, Spin, ComCtrls, ulazautoupdate, inifiles,
eventlog, umemoform, Zipper, strutils, asyncprocess, lclintf, types; eventlog, umemoform, Zipper, strutils, asyncprocess, lclintf, types,LResources,
LCLVersion;
type type
// Use FillVersionString and FillVersionInteger // Use FillVersionString and FillVersionInteger
@@ -238,6 +239,10 @@ type
var var
mainform: Tmainform; mainform: Tmainform;
sReadMePath:String;
aLRes: TLResource;
S: TResourceStream;
F: TFileStream;
implementation implementation
@@ -382,6 +387,7 @@ begin
ProfileConfig := TINIFile.Create(GetAppConfigDir(False) + C_PROFILECONFIGNAME); ProfileConfig := TINIFile.Create(GetAppConfigDir(False) + C_PROFILECONFIGNAME);
ProfilenameList := TStringList.Create; ProfilenameList := TStringList.Create;
ProfileRec.DragFileStringList := TStringList.Create; ProfileRec.DragFileStringList := TStringList.Create;
if FileExistsUTF8('readme.txt') then if FileExistsUTF8('readme.txt') then
begin begin
memo_intro.Lines.LoadFromFile('readme.txt'); memo_intro.Lines.LoadFromFile('readme.txt');
@@ -672,8 +678,8 @@ end;
procedure Tmainform.edt_WhatsNewTextFileChange(Sender: TObject); procedure Tmainform.edt_WhatsNewTextFileChange(Sender: TObject);
begin begin
edt_WhatsNewTextFile.InitialDir := ExtractFileDir(ProfileRec.WhatsNewPath); edt_WhatsNewTextFile.InitialDir := ExtractFileDir(ProfileRec.WhatsNewPath);
// ForceDirectoriesUTF8(ProfileRec.WhatsNewPath);
ProfileRec.WhatsNewPath := edt_WhatsNewTextFile.Filename; ProfileRec.WhatsNewPath := edt_WhatsNewTextFile.Filename;
ForceDirectoriesUTF8(ProfileRec.WhatsNewPath);
bCurrentProfileSaved := False; bCurrentProfileSaved := False;
end; end;
@@ -1033,7 +1039,7 @@ begin
cmb_profile.Clear; cmb_profile.Clear;
cmb_profile.Items := ProfileNameList; cmb_profile.Items := ProfileNameList;
// Set last item in list as current // Set last item in list as current
cmb_profile.ItemIndex := cmb_profile.Items.Count - 1; // cmb_profile.ItemIndex := cmb_profile.Items.Count - 1;
bCurrentProfileSaved := False; bCurrentProfileSaved := False;
end end
else else
@@ -1419,5 +1425,26 @@ begin
LAUTRayINI.Free; LAUTRayINI.Free;
end; end;
end; end;
initialization
// Unpack readme.txt
if (lcl_major > 0) and (lcl_minor > 6) then
begin
sReadMePath:=ProgramDirectory + 'readme.txt';
// This uses a resource file added via Project/Options (Laz 1.7+)
if not FileExistsUTF8(sReadMePath) then
begin
// create a resource stream which points to the po file
S := TResourceStream.Create(HInstance, 'README', MakeIntResource(10));
try
F := TFileStream.Create(sReadMePath, fmCreate);
try
F.CopyFrom(S, S.Size); // copy data from the resource stream to file stream
finally
F.Free; // destroy the file stream
end;
finally
S.Free; // destroy the resource stream
end;
end;
end;
end. end.

View File

@@ -14,6 +14,9 @@
<DpiAware Value="True"/> <DpiAware Value="True"/>
</XPManifest> </XPManifest>
<Icon Value="0"/> <Icon Value="0"/>
<Resources Count="1">
<Resource_0 FileName="readme.txt" Type="RCDATA" ResourceName="README"/>
</Resources>
</General> </General>
<i18n> <i18n>
<EnableI18N Value="True"/> <EnableI18N Value="True"/>
@@ -23,7 +26,7 @@
<UseVersionInfo Value="True"/> <UseVersionInfo Value="True"/>
<MajorVersionNr Value="1"/> <MajorVersionNr Value="1"/>
<MinorVersionNr Value="2"/> <MinorVersionNr Value="2"/>
<RevisionNr Value="6"/> <RevisionNr Value="7"/>
<StringTable Comments="Updated Jan 2017" FileDescription="Companion to LazAutoUpdate component" InternalName="updatepack" LegalCopyright="(c)2015 minesadorada@charcodelvalle.com" OriginalFilename="updatepack" ProductName="Lazarus/FPC" ProductVersion="2.6.4"/> <StringTable Comments="Updated Jan 2017" FileDescription="Companion to LazAutoUpdate component" InternalName="updatepack" LegalCopyright="(c)2015 minesadorada@charcodelvalle.com" OriginalFilename="updatepack" ProductName="Lazarus/FPC" ProductVersion="2.6.4"/>
</VersionInfo> </VersionInfo>
<BuildModes Count="5"> <BuildModes Count="5">