To V0.3.8

Improvements to MakeShortCut (Windows)
Test installer now self-updates

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5730 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
gbamber
2017-01-29 17:35:15 +00:00
parent 4938bf8ec4
commit 51c5b20239
13 changed files with 354 additions and 123 deletions

View File

@ -66,7 +66,7 @@ More information in the Wiki Home Page http://wiki.freepascal.org/LazAutoUpdater
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"/>
<Version Minor="3" Release="7" Build="2"/>
<Version Minor="3" Release="8"/>
<Files Count="7">
<Item1>
<Filename Value="ulazautoupdate.pas"/>

View File

@ -20,9 +20,8 @@
</i18n>
<VersionInfo>
<UseVersionInfo Value="True"/>
<RevisionNr Value="1"/>
<Attributes pvaPreRelease="True"/>
<StringTable Comments="Installet/Updater using LazAutoUpdate" ProductVersion="0.0.0.0"/>
<RevisionNr Value="2"/>
<StringTable Comments="Installer/Updater using LazAutoUpdate" CompanyName="minesadorada" FileDescription="Universal Installer and Updater using component LazAutoUpdate" InternalName="lauinstaller" LegalCopyright="(c)2017 minesadorada@charcodelvalle.com" ProductVersion="0.0.0.0"/>
</VersionInfo>
<BuildModes Count="5">
<Item1 Name="Win32debug" Default="True"/>

View File

@ -39,8 +39,7 @@ uses
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, umainform
{ you can add units after this };
Forms, umainform;
{$R *.res}

View File

@ -4,14 +4,13 @@
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="Linux64"/>
<Units Count="7">
<Units Count="17">
<Unit0>
<Filename Value="lauinstaller.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<EditorIndex Value="2"/>
<CursorPos X="25" Y="5"/>
<UsageCount Value="27"/>
<UsageCount Value="31"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -20,9 +19,9 @@
<ComponentName Value="mainform"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="179"/>
<CursorPos X="39" Y="202"/>
<UsageCount Value="27"/>
<TopLine Value="194"/>
<CursorPos X="65" Y="215"/>
<UsageCount Value="31"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit1>
@ -35,17 +34,19 @@
</Unit2>
<Unit3>
<Filename Value="..\ulazautoupdate.pas"/>
<EditorIndex Value="3"/>
<TopLine Value="2462"/>
<CursorPos Y="2415"/>
<UsageCount Value="12"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="10"/>
<TopLine Value="111"/>
<CursorPos X="18" Y="134"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit3>
<Unit4>
<Filename Value="..\ushortcut.pas"/>
<EditorIndex Value="2"/>
<CursorPos Y="6"/>
<UsageCount Value="12"/>
<EditorIndex Value="3"/>
<TopLine Value="403"/>
<CursorPos X="93" Y="449"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit4>
<Unit5>
@ -61,127 +62,203 @@
<CursorPos X="68" Y="324"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<Filename Value="X:\deleteme\issrc-master\issrc-master\Components\BidiUtils.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="34"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="X:\deleteme\issrc-master\issrc-master\Components\ScintStylerInnoSetup.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="624"/>
<UsageCount Value="10"/>
</Unit8>
<Unit9>
<Filename Value="X:\deleteme\issrc-master\issrc-master\Projects\Install.pas"/>
<EditorIndex Value="8"/>
<TopLine Value="85"/>
<CursorPos X="50" Y="24"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit9>
<Unit10>
<Filename Value="umakeshortcut.pas"/>
<EditorIndex Value="9"/>
<TopLine Value="150"/>
<CursorPos Y="166"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit10>
<Unit11>
<Filename Value="C:\laztrunk\fpc\packages\winunits-base\src\shlobj.pp"/>
<EditorIndex Value="7"/>
<TopLine Value="2332"/>
<CursorPos X="6" Y="2362"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit11>
<Unit12>
<Filename Value="C:\laztrunk\fpc\packages\winunits-base\src\shellapi.pp"/>
<UnitName Value="ShellApi"/>
<EditorIndex Value="6"/>
<TopLine Value="225"/>
<CursorPos X="19" Y="233"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit12>
<Unit13>
<Filename Value="C:\laztrunk\fpc\rtl\win\wininc\ascdef.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="85"/>
<CursorPos X="10" Y="113"/>
<UsageCount Value="10"/>
</Unit13>
<Unit14>
<Filename Value="C:\laztrunk\fpc\rtl\objpas\sysutils\finah.inc"/>
<EditorIndex Value="5"/>
<CursorPos X="10" Y="33"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit14>
<Unit15>
<Filename Value="C:\laztrunk\lazarus\components\lazutils\lazfileutils.pas"/>
<UnitName Value="LazFileUtils"/>
<EditorIndex Value="4"/>
<TopLine Value="58"/>
<CursorPos X="23" Y="102"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit15>
<Unit16>
<Filename Value="..\testapp\umainform.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="139"/>
<CursorPos Y="168"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit16>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="umainform.pas"/>
<Caret Line="42" Column="8" TopLine="29"/>
<Filename Value="umakeshortcut.pas"/>
<Caret Line="136" Column="43" TopLine="118"/>
</Position1>
<Position2>
<Filename Value="umainform.pas"/>
<Caret Line="73" Column="58" TopLine="30"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="199" TopLine="167"/>
</Position2>
<Position3>
<Filename Value="umainform.pas"/>
<Caret Line="82" TopLine="30"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="193" Column="21" TopLine="166"/>
</Position3>
<Position4>
<Filename Value="umainform.pas"/>
<Caret Line="54" Column="27" TopLine="13"/>
<Filename Value="X:\deleteme\issrc-master\issrc-master\Projects\Install.pas"/>
<Caret Line="1974" TopLine="1933"/>
</Position4>
<Position5>
<Filename Value="umainform.pas"/>
<Caret Line="62" Column="34" TopLine="53"/>
<Filename Value="X:\deleteme\issrc-master\issrc-master\Projects\Install.pas"/>
<Caret Line="1856" Column="45" TopLine="1831"/>
</Position5>
<Position6>
<Filename Value="umainform.pas"/>
<Caret Line="89" Column="49" TopLine="65"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="154" Column="21" TopLine="132"/>
</Position6>
<Position7>
<Filename Value="umainform.pas"/>
<Caret Line="36" TopLine="9"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="180" Column="59" TopLine="160"/>
</Position7>
<Position8>
<Filename Value="umainform.pas"/>
<Caret Line="60" Column="32" TopLine="33"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="205" TopLine="163"/>
</Position8>
<Position9>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1836" Column="7" TopLine="1813"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="198" Column="23" TopLine="171"/>
</Position9>
<Position10>
<Filename Value="umainform.pas"/>
<Caret Line="110" Column="7" TopLine="65"/>
<Caret Line="130" Column="24" TopLine="116"/>
</Position10>
<Position11>
<Filename Value="umainform.pas"/>
<Caret Line="60" Column="34" TopLine="50"/>
<Caret Line="131" Column="24" TopLine="117"/>
</Position11>
<Position12>
<Filename Value="umainform.pas"/>
<Caret Line="9" Column="51" TopLine="2"/>
<Caret Line="132" TopLine="123"/>
</Position12>
<Position13>
<Filename Value="umainform.pas"/>
<Caret Line="8" Column="35"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="442" TopLine="398"/>
</Position13>
<Position14>
<Filename Value="umainform.pas"/>
<Caret Line="108" Column="90" TopLine="65"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="436" Column="11" TopLine="404"/>
</Position14>
<Position15>
<Filename Value="umainform.pas"/>
<Caret Line="8" Column="22"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="438" Column="25" TopLine="404"/>
</Position15>
<Position16>
<Filename Value="umainform.pas"/>
<Caret Line="67" Column="69" TopLine="47"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="428" Column="45" TopLine="404"/>
</Position16>
<Position17>
<Filename Value="umainform.pas"/>
<Caret Line="13" Column="32"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="390" Column="27" TopLine="369"/>
</Position17>
<Position18>
<Filename Value="umainform.pas"/>
<Caret Line="78" Column="82" TopLine="52"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="438" Column="23" TopLine="401"/>
</Position18>
<Position19>
<Filename Value="umainform.pas"/>
<Caret Line="83" Column="36" TopLine="58"/>
<Filename Value="..\ushortcut.pas"/>
<Caret Line="440" Column="79" TopLine="404"/>
</Position19>
<Position20>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1923" TopLine="1888"/>
<Filename Value="umainform.pas"/>
<Caret Line="119" Column="50" TopLine="118"/>
</Position20>
<Position21>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1933" Column="60" TopLine="1897"/>
<Filename Value="umainform.pas"/>
<Caret Line="120" Column="50" TopLine="119"/>
</Position21>
<Position22>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1938" Column="83" TopLine="1903"/>
<Filename Value="umainform.pas"/>
<Caret Line="122" Column="50" TopLine="121"/>
</Position22>
<Position23>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1934" Column="41" TopLine="1902"/>
<Filename Value="umainform.pas"/>
<Caret Line="220" Column="30" TopLine="206"/>
</Position23>
<Position24>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="881" Column="38" TopLine="871"/>
<Filename Value="umainform.pas"/>
<Caret Line="105" Column="3" TopLine="103"/>
</Position24>
<Position25>
<Filename Value="umainform.pas"/>
<Caret Line="177" Column="46" TopLine="148"/>
<Caret Line="230" Column="27" TopLine="209"/>
</Position25>
<Position26>
<Filename Value="umainform.pas"/>
<Caret Line="117" Column="3" TopLine="115"/>
<Caret Line="215" Column="45" TopLine="193"/>
</Position26>
<Position27>
<Filename Value="umainform.pas"/>
<Caret Line="128" Column="38" TopLine="124"/>
<Caret Line="226" Column="56" TopLine="191"/>
</Position27>
<Position28>
<Filename Value="umainform.pas"/>
<Caret Line="166" Column="7" TopLine="139"/>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="355" Column="24" TopLine="326"/>
</Position28>
<Position29>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="139" Column="27" TopLine="126"/>
<Caret Line="1192" Column="17" TopLine="1182"/>
</Position29>
<Position30>
<Filename Value="..\ulazautoupdate.pas"/>
<Caret Line="1833" Column="17" TopLine="1806"/>
<Filename Value="umainform.pas"/>
<Caret Line="231" Column="20" TopLine="204"/>
</Position30>
</JumpHistory>
</ProjectSession>

View File

@ -5,10 +5,18 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "mainform"
msgstr ""
#: tmainform.cmd_deleteshortcuticon.caption
msgid "Delete Shortcut"
msgstr ""
#: tmainform.cmd_install.caption
msgid "Install"
msgstr ""
#: tmainform.cmd_makeshortcuticon.caption
msgid "Make Shortcut"
msgstr ""
#: tmainform.cmd_run.caption
msgid "Run"
msgstr ""
@ -29,3 +37,11 @@ msgstr ""
msgid "E&xit"
msgstr ""
#: tmainform.mnu_help.caption
msgid "&Help"
msgstr ""
#: tmainform.mnu_helpcheckforupdates.caption
msgid "Check for updates..."
msgstr ""

View File

@ -1,24 +1,26 @@
object mainform: Tmainform
Left = 737
Left = 728
Height = 241
Top = 222
Width = 320
Top = 209
Width = 408
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'mainform'
ClientHeight = 221
ClientWidth = 320
ClientWidth = 408
Menu = MainMenu1
OnActivate = FormActivate
OnClose = FormClose
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnShow = FormShow
Position = poWorkAreaCenter
LCLVersion = '1.7'
Scaled = True
object cmd_close: TBitBtn
Left = 125
Left = 167
Height = 30
Top = 179
Top = 176
Width = 75
Anchors = [akRight, akBottom]
DefaultCaption = True
@ -31,7 +33,7 @@ object mainform: Tmainform
Left = 0
Height = 113
Top = 0
Width = 320
Width = 408
Align = alTop
AutoFill = True
Caption = 'Application'
@ -43,7 +45,7 @@ object mainform: Tmainform
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 93
ClientWidth = 316
ClientWidth = 404
ItemIndex = 2
Items.Strings = (
'LazAutoUpdate Update Pack'
@ -58,11 +60,11 @@ object mainform: Tmainform
Left = 0
Height = 57
Top = 113
Width = 320
Width = 408
Align = alTop
Caption = 'Action'
ClientHeight = 37
ClientWidth = 316
ClientWidth = 404
TabOrder = 2
object cmd_Install: TButton
Left = 8
@ -82,6 +84,26 @@ object mainform: Tmainform
OnClick = cmd_RunClick
TabOrder = 1
end
object cmd_MakeShortcutIcon: TButton
Left = 176
Height = 25
Top = 0
Width = 103
AutoSize = True
Caption = 'Make Shortcut'
OnClick = cmd_MakeShortcutIconClick
TabOrder = 2
end
object cmd_DeleteShortcutIcon: TButton
Left = 288
Height = 25
Top = 0
Width = 107
AutoSize = True
Caption = 'Delete Shortcut'
OnClick = cmd_DeleteShortcutIconClick
TabOrder = 3
end
end
object LazAutoUpdate1: TLazAutoUpdate
About.Description.Strings = (
@ -127,5 +149,12 @@ object mainform: Tmainform
OnClick = mnu_fileExitClick
end
end
object mnu_help: TMenuItem
Caption = '&Help'
object mnu_helpCheckForUpdates: TMenuItem
Caption = 'Check for updates...'
OnClick = mnu_helpCheckForUpdatesClick
end
end
end
end

View File

@ -4,6 +4,10 @@
{"hash":75149406,"name":"tmainform.grp_action.caption","sourcebytes":[65,99,116,105,111,110],"value":"Action"},
{"hash":5941372,"name":"tmainform.cmd_install.caption","sourcebytes":[73,110,115,116,97,108,108],"value":"Install"},
{"hash":22974,"name":"tmainform.cmd_run.caption","sourcebytes":[82,117,110],"value":"Run"},
{"hash":250142468,"name":"tmainform.cmd_makeshortcuticon.caption","sourcebytes":[77,97,107,101,32,83,104,111,114,116,99,117,116],"value":"Make Shortcut"},
{"hash":228824468,"name":"tmainform.cmd_deleteshortcuticon.caption","sourcebytes":[68,101,108,101,116,101,32,83,104,111,114,116,99,117,116],"value":"Delete Shortcut"},
{"hash":2805797,"name":"tmainform.mnu_file.caption","sourcebytes":[38,70,105,108,101],"value":"&File"},
{"hash":4710148,"name":"tmainform.mnu_fileexit.caption","sourcebytes":[69,38,120,105,116],"value":"E&xit"}
{"hash":4710148,"name":"tmainform.mnu_fileexit.caption","sourcebytes":[69,38,120,105,116],"value":"E&xit"},
{"hash":2812976,"name":"tmainform.mnu_help.caption","sourcebytes":[38,72,101,108,112],"value":"&Help"},
{"hash":5395918,"name":"tmainform.mnu_helpcheckforupdates.caption","sourcebytes":[67,104,101,99,107,32,102,111,114,32,117,112,100,97,116,101,115,46,46,46],"value":"Check for updates..."}
]}

View File

@ -1,4 +1,5 @@
unit umainform;
{
License (MIT)
=============
@ -40,24 +41,33 @@ type
{ Tmainform }
Tmainform = class(TForm)
cmd_DeleteShortcutIcon: TButton;
cmd_MakeShortcutIcon: TButton;
cmd_Run: TButton;
cmd_Install: TButton;
cmd_close: TBitBtn;
grp_Action: TGroupBox;
LazAutoUpdate1: TLazAutoUpdate;
MainMenu1: TMainMenu;
mnu_helpCheckForUpdates: TMenuItem;
mnu_help: TMenuItem;
mnu_fileExit: TMenuItem;
mnu_file: TMenuItem;
grp_Application: TRadioGroup;
procedure cmd_DeleteShortcutIconClick(Sender: TObject);
procedure cmd_InstallClick(Sender: TObject);
procedure cmd_MakeShortcutIconClick(Sender: TObject);
procedure cmd_RunClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure grp_ApplicationSelectionChanged(Sender: TObject);
procedure LazAutoUpdate1DebugEvent(Sender: TObject;
lauMethodName, lauMessage: string);
procedure mnu_fileExitClick(Sender: TObject);
procedure mnu_helpCheckForUpdatesClick(Sender: TObject);
private
Logger: TEventLog;
procedure ConfigureLazAutoUpdate(const AItemIndex: integer);
@ -72,8 +82,8 @@ var
implementation
{$R *.lfm}
Var
sDirectoryToInstallTo:String;
var
sDirectoryToInstallTo: string;
{ Tmainform }
@ -82,7 +92,7 @@ begin
Caption := Application.Title;
Icon := Application.Icon;
sDirectoryToInstallTo := ProgramDirectory + 'installed';
LazAutoUpdate1.DebugMode:=TRUE;
LazAutoUpdate1.DebugMode := True;
LazAutoUpdate1.ShowUpdateInCaption := True;
ConfigureLazAutoUpdate(2); // Default is TestApp
Logger := TEventLog.Create(nil);
@ -91,6 +101,11 @@ begin
Logger.Active := True; // Logging uses OnDebugEvent of LazAutoUpdate
end;
procedure Tmainform.FormShow(Sender: TObject);
begin
end;
procedure Tmainform.cmd_InstallClick(Sender: TObject);
begin
LazAutoUpdate1.WorkingMode := lauInstall;
@ -111,11 +126,40 @@ begin
LazAutoUpdate1.WorkingMode := lauUpdate;
end;
procedure Tmainform.cmd_DeleteShortcutIconClick(Sender: TObject);
begin
if not FileExistsUTF8(LazAutoUpdate1.AppFileWithPath) then
begin
ShowMessageFmt('%s does not exist! Install it first.',
[LazAutoUpdate1.AppFileWithPath]);
Exit;
end;
if LazAutoUpdate1.DeleteShortCut then
ShowMessage('Desktop shortcut and menu item are toast');
end;
procedure Tmainform.cmd_MakeShortcutIconClick(Sender: TObject);
begin
if not FileExistsUTF8(LazAutoUpdate1.AppFileWithPath) then
begin
ShowMessageFmt('%s does not exist! Install it first.',
[LazAutoUpdate1.AppFileWithPath]);
Exit;
end;
if LazAutoUpdate1.MakeShortCut then
ShowMessage('Desktop shortcut and menu item created');
end;
procedure Tmainform.cmd_RunClick(Sender: TObject);
begin
RunInstalledApp;
end;
procedure Tmainform.FormActivate(Sender: TObject);
begin
LazAutoUpdate1.ShowWhatsNewIfAvailable;
end;
procedure Tmainform.RunInstalledApp;
var
AProcess: TAsyncProcess;
@ -146,11 +190,11 @@ end;
procedure Tmainform.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
If LazAutoUpdate1.DownloadInProgress Then
Begin
if LazAutoUpdate1.DownloadInProgress then
begin
CanClose := False;
ShowMessage('Please wait. Download is still in progress.');
End;
end;
end;
procedure Tmainform.grp_ApplicationSelectionChanged(Sender: TObject);
@ -169,6 +213,22 @@ begin
Close;
end;
procedure Tmainform.mnu_helpCheckForUpdatesClick(Sender: TObject);
var
OldItemIndex: integer;
begin
OldItemIndex := grp_Application.ItemIndex;
LazAutoUpdate1.ProjectType := auSourceForge; // can be auGitHubReleaseZip or auOther
LazAutoUpdate1.SFProjectname := 'lazautoupdate'; // Or GitHub properties
LazAutoUpdate1.UpdatesFolder := 'updates'; // Subfolder in repository
LazAutoUpdate1.VersionsININame := 'lauinstaller' + C_PFX + '.ini'; // as specified
LazAutoUpdate1.ZipfileName := 'lauinstaller' + C_PFX + '.zip'; // as specified
LazAutoUpdate1.AppFileWithPath := Application.Exename;
If NOT LazAutoUpdate1.AutoUpdate then
ConfigureLazAutoUpdate(OldItemIndex); // Restore properties
end;
procedure Tmainform.ConfigureLazAutoUpdate(const AItemIndex: integer);
begin
// Note: This routine relies on a consistent naming convention for your
@ -176,7 +236,8 @@ begin
case AItemIndex of
0: //Update Pack
begin
LazAutoUpdate1.ProjectType := auSourceForge; // can be auGitHubReleaseZip or auOther
LazAutoUpdate1.ProjectType := auSourceForge;
// can be auGitHubReleaseZip or auOther
LazAutoUpdate1.SFProjectname := 'lazautoupdate'; // Or GitHub properties
LazAutoUpdate1.UpdatesFolder := 'updates'; // Subfolder in repository
LazAutoUpdate1.VersionsININame := 'updatepack' + C_PFX + '.ini'; // as specified
@ -186,13 +247,16 @@ begin
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'updatepack.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'updatepack';
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'updatepack';
{$ENDIF}
// Our responsibility to make the folder
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
LazAutoUpdate1.ShortCut.Category := scUtility;
LazAutoUpdate1.ShortCut.Target := LazAutoUpdate1.AppFileWithPath;
LazAutoUpdate1.ShortCut.ShortcutName := 'LazAutoUpdate Update Pack';
end;
1: // Test Application (GitHub)
begin
@ -204,15 +268,18 @@ begin
LazAutoUpdate1.VersionsININame := 'testapp' + C_PFX + '.ini';
LazAutoUpdate1.ZipfileName := 'testapp' + C_PFX + '.zip';
{$IFDEF WINDOWS}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'testapp' + C_PFX + '.exe';
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'testapp' + C_PFX + '.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'testapp' + C_PFX;
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'testapp' + C_PFX;
{$ENDIF}
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
LazAutoUpdate1.ShortCut.Category := scUtility;
LazAutoUpdate1.ShortCut.Target := LazAutoUpdate1.AppFileWithPath;
LazAutoUpdate1.ShortCut.ShortcutName := 'LazAutoUpdate Test App';
end;
2: // Test Application (SourceForge)
begin
@ -222,15 +289,18 @@ begin
LazAutoUpdate1.VersionsININame := 'testapp' + C_PFX + '.ini';
LazAutoUpdate1.ZipfileName := 'testapp' + C_PFX + '.zip';
{$IFDEF WINDOWS}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'testapp' + C_PFX + '.exe';
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'testapp' + C_PFX + '.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'testapp' + C_PFX;
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'testapp' + C_PFX;
{$ENDIF}
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
LazAutoUpdate1.ShortCut.Category := scUtility;
LazAutoUpdate1.ShortCut.Target := LazAutoUpdate1.AppFileWithPath;
LazAutoUpdate1.ShortCut.ShortcutName := 'LazAutoUpdate Test App';
end;
3: // Retro Ski Run
begin
@ -240,15 +310,18 @@ begin
LazAutoUpdate1.VersionsININame := 'ski' + C_PFX + '.ini';
LazAutoUpdate1.ZipfileName := 'ski' + C_PFX + '.zip';
{$IFDEF WINDOWS}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'ski' + C_PFX + '.exe';
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'ski' + C_PFX + '.exe';
{$ELSE}
LazAutoUpdate1.AppFileWithPath := sDirectoryToInstallTo +
DirectorySeparator + 'ski' + C_PFX;
LazAutoUpdate1.AppFileWithPath :=
sDirectoryToInstallTo + DirectorySeparator + 'ski' + C_PFX;
{$ENDIF}
if not DirectoryExistsUTF8(sDirectoryToInstallTo) then
ForceDirectoriesUTF8(sDirectoryToInstallTo);
LazAutoUpdate1.Appversion := '0.0.0.0';
LazAutoUpdate1.ShortCut.Category := scGame;
LazAutoUpdate1.ShortCut.Target := LazAutoUpdate1.AppFileWithPath;
LazAutoUpdate1.ShortCut.ShortcutName := 'Retro Ski Run';
end;
end;
end;

View File

@ -145,9 +145,9 @@ const
V0.3.7: Added public property Mode=(lauUpdate|lauInstall)
V0.3.7.1: Added (DoSilentUpdate) copy C_UPDATEHMNAME to installed folder
V0.3.7.2: Unix: SetExecutePermissions on installed app
V0.3.8: ??
V0.3.8: Shortcut Menu items now created/deleted
}
C_TLazAutoUpdateComponentVersion = '0.3.7.2';
C_TLazAutoUpdateComponentVersion = '0.3.8';
C_TThreadedDownloadComponentVersion = '0.0.3.0';
{
V0.0.1: Initial alpha
@ -352,7 +352,7 @@ type
// Put in form.activate. Shows <whatsnew.txt> only if in ProgramDirectory then deletes it. Exits otherwise
procedure ShowWhatsNewIfAvailable;
// Checks for new version then shows dialogs to update
procedure AutoUpdate;
Function AutoUpdate:Boolean;
// No dialogs - what it says on the tin.
function SilentUpdate: boolean;
// Used in SilentUpdate. Shells to local lauupdate(.exe)
@ -1184,12 +1184,12 @@ begin
end;
end;
procedure TLazAutoUpdate.AutoUpdate;
Function TLazAutoUpdate.AutoUpdate:Boolean;
// Do-all proc that user can drop into a menu
begin
if Assigned(fOndebugEvent) then
fFireDebugEvent := True;
Result:=False;
if fFireDebugEvent then
fOndebugEvent(Self, 'AutoUpdate', 'Calling NewVersionAvailable');
if NewVersionAvailable then
@ -1231,9 +1231,12 @@ begin
mtInformation, [mbOK], 0);
end
else
begin
MessageDlg(fParentApplication.Title,
rsThisApplicat,
mtInformation, [mbOK], 0);
Result:=TRUE;
end;
end;
function TLazAutoUpdate.IsOnlineVersionNewer(const sznewINIPath: string): boolean;

View File

@ -9,7 +9,7 @@
"ForceNotify" : false,
"InternalVersion" : 1,
"Name" : "lazupdate.lpk",
"Version" : "0.3.7.2"
"Version" : "0.3.8.0"
}
]
}

View File

@ -176,21 +176,35 @@ begin
ISLink.SetPath(PChar(Target));
ISLink.SetArguments(PChar(TargetArguments));
ISLink.SetWorkingDirectory(PChar(ExtractFilePath(Target)));
{
Not needed
ISLink.SetIconLocation(Pchar(ExtractFilePath(Target) + IconFileName),0);
}
{ Get the desktop location }
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + '.lnk';
{ Get rid of any existing shortcut first }
if not SysUtils.DeleteFile(LinkName) then
AddToDebugString('Could not delete existing link ' + LinkName);
{Create the link }
IPFile.Save(PWChar(LinkName), False);
{Notify the shell}
SHChangeNotify(SHCNE_CREATE, SHCNF_PATH, PChar(LinkName), nil);
SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH or SHCNF_FLUSH,
PChar(ExtractFileDir(LinkName)), nil);
{Menu Entry}
SHGetSpecialFolderLocation(0, CSIDL_PROGRAMS, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
If Not DirectoryExistsUTF8(IncludeTrailingPathDelimiter(InFolder) + ShortcutName) then
ForceDirectoriesUTF8(IncludeTrailingPathDelimiter(InFolder) + ShortcutName);
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + DirectorySeparator + ShortcutName + '.lnk';
{ Get rid of any existing shortcut first }
if not SysUtils.DeleteFile(LinkName) then
AddToDebugString('Could not delete existing link ' + LinkName);
{Create the menu entry link }
IPFile.Save(PWChar(LinkName), False);
{Notify the shell}
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATH, PChar(LinkName), nil)
finally
// Not needed: FreeAndNil(IPFile);
end;
@ -408,6 +422,23 @@ begin
end
else
AddToDebugString('DeleteDesktopShortcut Failure: Unable to delete ' + LinkName);
{ Get the menu location}
SHGetSpecialFolderLocation(0, CSIDL_PROGRAMS, PIDL);
SHGetPathFromIDList(PIDL, InFolder);
LinkName := IncludeTrailingPathDelimiter(InFolder) + ShortcutName + DirectorySeparator + ShortcutName + '.lnk';
{ Get rid of any existing shortcut first }
if SysUtils.DeleteFile(LinkName) then
begin
AddToDebugString('DeleteDesktopShortcut Success: Deleted ' + LinkName);
Result := True;
end
else
AddToDebugString('DeleteDesktopShortcut Failure: Unable to delete ' + LinkName);
If DirectoryExistsUTF8(IncludeTrailingPathDelimiter(InFolder) + ShortcutName) then
If RemoveDirUTF8(IncludeTrailingPathDelimiter(InFolder) + ShortcutName) then
AddToDebugString('DeleteDesktopShortcut Success: Deleted menu entry')
else
AddToDebugString('DeleteDesktopShortcut Failure: Unable to delete menu entry');
except
AddToDebugString('Exception deleting ' + LinkName);
// Eat the exception