You've already forked lazarus-ccr
Code tidy up. Versions unchanged
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5686 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -87,10 +87,6 @@ msgstr "Please wait. Processing...."
|
||||
msgid "Property SFProjectName is empty!"
|
||||
msgstr "Property SFProjectName is empty!"
|
||||
|
||||
#: ulazautoupdate.c_sourceforgedownload
|
||||
msgid "SourceForge download"
|
||||
msgstr "SourceForge download"
|
||||
|
||||
#: ulazautoupdate.c_takingtoolong
|
||||
msgid "Check is taking too long (bad/slow internet connection?). Try again later?"
|
||||
msgstr "Check is taking too long (bad/slow internet connection?). Try again later?"
|
||||
@ -164,3 +160,4 @@ msgstr "This application is up-to-date"
|
||||
#: ulazautoupdate.rsvewversionsh
|
||||
msgid "Vew version %s has downloaded. Click OK to update now."
|
||||
msgstr "Vew version %s has downloaded. Click OK to update now."
|
||||
|
||||
|
@ -87,10 +87,6 @@ msgstr "Espera. Procesamiento de..."
|
||||
msgid "Property SFProjectName is empty!"
|
||||
msgstr "¡Propiedad SFProjectName está vacía!"
|
||||
|
||||
#: ulazautoupdate.c_sourceforgedownload
|
||||
msgid "SourceForge download"
|
||||
msgstr "Descargar de SourceForge"
|
||||
|
||||
#: ulazautoupdate.c_takingtoolong
|
||||
msgid "Check is taking too long (bad/slow internet connection?). Try again later?"
|
||||
msgstr "Cheque tarda demasiado (mala/lenta conexión a internet?). ¿Inténtalo más tarde?"
|
||||
@ -164,3 +160,4 @@ msgstr "Esta aplicación es actualizada"
|
||||
#: ulazautoupdate.rsvewversionsh
|
||||
msgid "Vew version %s has downloaded. Click OK to update now."
|
||||
msgstr "Ver versión %s se ha descargado. Haga clic en Aceptar para actualizar ahora."
|
||||
|
||||
|
@ -77,10 +77,6 @@ msgstr ""
|
||||
msgid "Property SFProjectName is empty!"
|
||||
msgstr ""
|
||||
|
||||
#: ulazautoupdate.c_sourceforgedownload
|
||||
msgid "SourceForge download"
|
||||
msgstr ""
|
||||
|
||||
#: ulazautoupdate.c_takingtoolong
|
||||
msgid "Check is taking too long (bad/slow internet connection?). Try again later?"
|
||||
msgstr ""
|
||||
|
@ -10,7 +10,7 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<CursorPos X="25" Y="28"/>
|
||||
<UsageCount Value="54"/>
|
||||
<UsageCount Value="55"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
@ -19,10 +19,9 @@
|
||||
<ComponentName Value="mainform"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="97"/>
|
||||
<CursorPos X="23" Y="119"/>
|
||||
<UsageCount Value="54"/>
|
||||
<TopLine Value="59"/>
|
||||
<CursorPos X="4" Y="108"/>
|
||||
<UsageCount Value="55"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@ -33,7 +32,7 @@
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="3"/>
|
||||
<CursorPos X="76" Y="8"/>
|
||||
<UsageCount Value="37"/>
|
||||
<UsageCount Value="38"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
@ -45,14 +44,15 @@
|
||||
<Unit4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="184"/>
|
||||
<CursorPos X="50" Y="204"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="478"/>
|
||||
<CursorPos X="28" Y="502"/>
|
||||
<ExtraEditorCount Value="2"/>
|
||||
<ExtraEditor1>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="2255"/>
|
||||
<CursorPos X="22" Y="2277"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="216"/>
|
||||
<CursorPos X="50" Y="236"/>
|
||||
</ExtraEditor1>
|
||||
<ExtraEditor2>
|
||||
<EditorIndex Value="-1"/>
|
||||
@ -145,8 +145,8 @@
|
||||
<Filename Value="..\updatehmsource\updatehm.lpr"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<WindowIndex Value="1"/>
|
||||
<TopLine Value="35"/>
|
||||
<CursorPos X="40" Y="51"/>
|
||||
<TopLine Value="132"/>
|
||||
<CursorPos X="6" Y="338"/>
|
||||
<UsageCount Value="17"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit16>
|
||||
@ -162,129 +162,126 @@
|
||||
<OtherDefines Count="1">
|
||||
<Define0 Value="DEBUGMODE"/>
|
||||
</OtherDefines>
|
||||
<General>
|
||||
<ActiveWindowIndexAtStart Value="1"/>
|
||||
</General>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="61" Column="80" TopLine="37"/>
|
||||
<Caret Line="592" Column="3" TopLine="567"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="757" Column="2" TopLine="718"/>
|
||||
<Caret Line="982" TopLine="966"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2282" Column="46" TopLine="2250"/>
|
||||
<Caret Line="1745" Column="17" TopLine="1720"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="592" Column="3" TopLine="567"/>
|
||||
<Caret Line="1898" Column="17" TopLine="1873"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="982" TopLine="966"/>
|
||||
<Caret Line="2267" TopLine="2247"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1745" Column="17" TopLine="1720"/>
|
||||
<Caret Line="2286" Column="17" TopLine="2247"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1898" Column="17" TopLine="1873"/>
|
||||
<Caret Line="2270" TopLine="2246"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2267" TopLine="2247"/>
|
||||
<Caret Line="2273" Column="17" TopLine="2246"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2286" Column="17" TopLine="2247"/>
|
||||
<Caret Line="2269" TopLine="2244"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2270" TopLine="2246"/>
|
||||
<Caret Line="592" Column="3" TopLine="567"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2273" Column="17" TopLine="2246"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="99" Column="38" TopLine="64"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2269" TopLine="2244"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="127" Column="28" TopLine="123"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="592" Column="3" TopLine="567"/>
|
||||
<Caret Line="472" Column="22" TopLine="446"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="99" Column="38" TopLine="64"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1094" Column="27" TopLine="1082"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="127" Column="28" TopLine="123"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1117" Column="23" TopLine="1082"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="472" Column="22" TopLine="446"/>
|
||||
<Caret Line="1120" Column="35" TopLine="1082"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1094" Column="27" TopLine="1082"/>
|
||||
<Caret Line="1123" Column="35" TopLine="1082"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1117" Column="23" TopLine="1082"/>
|
||||
<Caret Line="1316" Column="25" TopLine="1298"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1120" Column="35" TopLine="1082"/>
|
||||
<Caret Line="1324" Column="23" TopLine="1298"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1123" Column="35" TopLine="1082"/>
|
||||
<Caret Line="1358" Column="73" TopLine="1264"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1316" Column="25" TopLine="1298"/>
|
||||
<Caret Line="2187" Column="58" TopLine="2140"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1324" Column="23" TopLine="1298"/>
|
||||
<Caret Line="2216" Column="15" TopLine="2169"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1358" Column="73" TopLine="1264"/>
|
||||
<Caret Line="2231" Column="46" TopLine="2205"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2187" Column="58" TopLine="2140"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="133" TopLine="113"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2216" Column="15" TopLine="2169"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="19" Column="43" TopLine="7"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="2231" Column="46" TopLine="2205"/>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="153" TopLine="123"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="133" TopLine="113"/>
|
||||
<Caret Line="165" TopLine="124"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="19" Column="43" TopLine="7"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="209" Column="24" TopLine="184"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="153" TopLine="123"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="193" Column="17" TopLine="184"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="umainform.pas"/>
|
||||
<Caret Line="165" TopLine="124"/>
|
||||
<Filename Value="..\ulazautoupdate.pas"/>
|
||||
<Caret Line="1929" Column="33" TopLine="1904"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
@ -1,12 +1,26 @@
|
||||
unit ulazautoupdate;
|
||||
|
||||
{
|
||||
Summary and Copyright
|
||||
=====================
|
||||
LazAutoUpdate (c)2015 Gordon Bamber (minesadorada@charcodelvalle.com)
|
||||
A Lazarus Visual component that enables an update service for Executables.
|
||||
|
||||
Web References
|
||||
==============
|
||||
Wiki Page: http://wiki.freepascal.org/LazAutoUpdater
|
||||
Forum thread: http://forum.lazarus.freepascal.org/index.php/topic,25444.0.html
|
||||
SourceForge project: https://sourceforge.net/projects/lazautoupdate/
|
||||
|
||||
Other Credits
|
||||
=============
|
||||
VersionSupport: Mike Thompson - mike.cornflake@gmail.com
|
||||
Added to and modified by minesadorada@charcodelvalle.com
|
||||
Windows admin function: Vincent at freepascal forum
|
||||
(added to and modified by minesadorada@charcodelvalle.com)
|
||||
Windows admin RunAs function: Vincent at freepascal forum
|
||||
THpttpClient code: GetMem at freepascal forum
|
||||
|
||||
License
|
||||
=======
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at your
|
||||
@ -31,6 +45,12 @@ unit ulazautoupdate;
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
Version Control and History
|
||||
===========================
|
||||
Via SVN: https://svn.code.sf.net/p/lazarus-ccr/svn/components/lazautoupdate/
|
||||
Via SourceForge: https://sourceforge.net/projects/lazautoupdate/
|
||||
Also see 'Version History' below
|
||||
}
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -62,6 +82,8 @@ const
|
||||
C_LAUTRayINI = 'lauimport.ini';
|
||||
|
||||
{
|
||||
Version History
|
||||
===============
|
||||
V0.0.1: Initial alpha
|
||||
V0.0.2: Added auOther properties
|
||||
V0.0.3: Limit to download time
|
||||
@ -130,21 +152,31 @@ const
|
||||
C_GUIEntry = 'GUI';
|
||||
C_ModuleEntry = 'Module';
|
||||
C_MASTER = 'master';
|
||||
// Compiler mode directives
|
||||
// (note: nothing for Mac/Darwin)
|
||||
{$IFDEF WINDOWS}
|
||||
{$IFDEF CPU32}C_UPDATER = 'updatehmwin32.exe';
|
||||
C_LOCALUPDATER = 'lauupdatewin32.exe';{$ENDIF}
|
||||
{$IFDEF CPU64}C_UPDATER = 'updatehmwin64.exe';
|
||||
C_LOCALUPDATER = 'lauupdatewin64.exe';{$ENDIF}
|
||||
// Windows Constants
|
||||
C_RUNONCEKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce';
|
||||
C_RUNKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run';
|
||||
{$IFDEF CPU32}
|
||||
C_UPDATER = 'updatehmwin32.exe';
|
||||
C_LOCALUPDATER = 'lauupdatewin32.exe';
|
||||
{$ENDIF}
|
||||
{$IFDEF CPU64}
|
||||
C_UPDATER = 'updatehmwin64.exe';
|
||||
C_LOCALUPDATER = 'lauupdatewin64.exe';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF LINUX}
|
||||
{$IFDEF CPU32}C_UPDATER = 'updatehmlinux32';
|
||||
C_LOCALUPDATER = 'lauupdatelinux32';{$ENDIF}
|
||||
{$IFDEF CPU64}C_UPDATER = 'updatehmlinux64';
|
||||
C_LOCALUPDATER = 'lauupdatelinux64';{$ENDIF}
|
||||
{$IFDEF CPU32}
|
||||
C_UPDATER = 'updatehmlinux32';
|
||||
C_LOCALUPDATER = 'lauupdatelinux32';
|
||||
{$ENDIF}
|
||||
{$IFDEF CPU64}
|
||||
C_UPDATER = 'updatehmlinux64';
|
||||
C_LOCALUPDATER = 'lauupdatelinux64';
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
// Windows Constants (unused)
|
||||
C_RUNONCEKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce';
|
||||
C_RUNKEY = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run';
|
||||
|
||||
resourcestring
|
||||
C_ComponentPrettyName = 'Lazarus Auto-Update Component';
|
||||
@ -174,7 +206,7 @@ resourcestring
|
||||
C_FolderMissing = 'Missing %s folder';
|
||||
C_NotApplicable = '<not applicable>';
|
||||
C_ThreadStarted = 'Thread Started';
|
||||
C_SourceForgeDownload = 'SourceForge download';
|
||||
// C_SourceForgeDownload = 'SourceForge download';
|
||||
C_CannotLoadFromRemote = 'Cannot load document from remote server';
|
||||
C_DownloadIsEmpty = 'Downloaded document is empty.';
|
||||
C_DownloadFailedErrorCode = 'Download failed with error code ';
|
||||
@ -464,6 +496,11 @@ type
|
||||
fLastError: string; // Propagated to TThreadedDownload
|
||||
constructor Create(URL, FileName: string);
|
||||
procedure Execute; override; // Starts thread
|
||||
// Todo:
|
||||
{
|
||||
procedure GetDownloadSize;
|
||||
procedure ShowProgress;
|
||||
}
|
||||
end;
|
||||
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
program updatehm;
|
||||
|
||||
{$ifdef Linux}
|
||||
|
||||
{$ifdef FPC_CROSSCOMPILING}
|
||||
|
||||
{$ifdef CPUARM}
|
||||
//if GUI, then uncomment
|
||||
//if GUI, then uncomment
|
||||
|
||||
//{$linklib GLESv2}
|
||||
//{$linklib GLESv2}
|
||||
|
||||
{$endif}
|
||||
|
||||
@ -56,7 +57,9 @@ program updatehm;
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
LazUTF8,LazFileUtils,FileUtil,
|
||||
LazUTF8,
|
||||
LazFileUtils,
|
||||
FileUtil,
|
||||
process,
|
||||
eventlog,
|
||||
DateUtils,
|
||||
@ -119,7 +122,7 @@ var
|
||||
|
||||
begin
|
||||
if ParamCount = 0 then
|
||||
begin
|
||||
begin
|
||||
WriteLn('==========================================================');
|
||||
Writeln(LineEnding + '==== updatehm v' + C_Version +
|
||||
' - an lazautoupdate application ====');
|
||||
@ -128,10 +131,10 @@ begin
|
||||
WriteLn('Press any key to continue');
|
||||
ReadLn;
|
||||
Halt;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (ParamStrUTF8(1) = '-h') or (ParamStrUTF8(1) = '/h') then
|
||||
begin
|
||||
begin
|
||||
WriteLn('==========================================================');
|
||||
Writeln('Normal usage: updatehm exename.exe [updatesfoldername] [whatnewfilename] [exePrettyName] [copytree]');
|
||||
WriteLn('- where exename.exe is a single application to be updated');
|
||||
@ -142,14 +145,20 @@ begin
|
||||
WriteLn('Press any key to continue');
|
||||
ReadLn;
|
||||
Halt;
|
||||
end;
|
||||
end;
|
||||
|
||||
Logger := TEventLog.Create(nil);
|
||||
Logger.LogType := ltFile;
|
||||
Logger.FileName := C_LogFileName;
|
||||
if FileExistsUTF8(C_LogFileName) then
|
||||
DeleteFile(C_LogFileName);
|
||||
Logger.Active := True;
|
||||
try
|
||||
Logger.LogType := ltFile;
|
||||
Logger.FileName := C_LogFileName;
|
||||
if FileExistsUTF8(C_LogFileName) then
|
||||
DeleteFile(C_LogFileName);
|
||||
Logger.Active := True;
|
||||
except
|
||||
Logger.Active := False;
|
||||
FreeAndNil(Logger);
|
||||
Halt(1);
|
||||
end;
|
||||
Logger.Info('Start of Log');
|
||||
|
||||
bCopyTreeSuccess := False;
|
||||
@ -195,31 +204,31 @@ begin
|
||||
Logger.Info('Updated whatsNew path = ' + szUpdatedWNPath);
|
||||
|
||||
if not FileExistsUTF8(szUpdatedEXEPath) then
|
||||
begin
|
||||
begin
|
||||
WriteAndLog('Couldn''t find szUpdatedEXEPath');
|
||||
Logger.Active := False;
|
||||
FreeAndNil(Logger);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
if FileExistsUTF8(szUpdatedWNPath) then
|
||||
begin
|
||||
begin
|
||||
// Write a file to disk that the app keeps checking for.
|
||||
try
|
||||
try
|
||||
Fileutil.CopyFile(szUpdatedWNPath, szOldWNPath, [cffOverWriteFile]);
|
||||
WriteAndLog('Writing.. ' + szWhatsNewName);
|
||||
except
|
||||
except
|
||||
On E: Exception do
|
||||
begin
|
||||
begin
|
||||
WriteAndLog(Format('There was a problem writing %s. Reason: %s',
|
||||
[szWhatsNewName, E.Message]));
|
||||
Logger.Active := False;
|
||||
FreeAndNil(Logger);
|
||||
Halt(1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// The calling app is in a loop - waiting to detect
|
||||
// a Whatsnew file in it's home directory
|
||||
@ -242,61 +251,62 @@ begin
|
||||
// Copied to the global application data folder
|
||||
// Add entry 'Location'
|
||||
if FileExistsUTF8(szUpdatesFullPath + C_LAUTRayINI) then
|
||||
begin
|
||||
szLAUTrayAppPath := GetAppConfigDirUTF8(False, True);;
|
||||
try
|
||||
begin
|
||||
szLAUTrayAppPath := GetAppConfigDirUTF8(False, True);
|
||||
;
|
||||
try
|
||||
ForceDirectory(szLAUTrayAppPath);
|
||||
Fileutil.CopyFile(szUpdatesFullPath + C_LAUTRayINI, szLAUTrayAppPath +
|
||||
C_LAUTRayINI, [cffOverWriteFile]);
|
||||
WriteAndLog(Format('Successfully copied %s to %s ',
|
||||
[C_LAUTRayINI, szLAUTrayAppPath]));
|
||||
if FileExistsUTF8(szLAUTrayAppPath + C_LAUTRayINI) then
|
||||
begin
|
||||
begin
|
||||
INI := TINIFile.Create(szLAUTrayAppPath + C_LAUTRayINI);
|
||||
SectionStringList := TStringList.Create;
|
||||
try
|
||||
try
|
||||
INI.ReadSections(SectionStringList);
|
||||
if SectionStringList.Count > 0 then
|
||||
begin
|
||||
begin
|
||||
INI.WriteString(SectionStringList[0], 'Location', ProgramDirectory);
|
||||
WriteAndLog(Format('Wrote new entry in section %s. Location=%s',
|
||||
[SectionStringList[0], ProgramDirectory]));
|
||||
end
|
||||
end
|
||||
else
|
||||
WriteAndLog('Failed to find a valid section in ' + C_LAUTRayINI);
|
||||
finally
|
||||
finally
|
||||
FreeAndNil(SectionStringList);
|
||||
FreeAndNil(INI);
|
||||
end;
|
||||
end
|
||||
end;
|
||||
end
|
||||
else
|
||||
WriteAndLog('Failed to copy ' + C_LAUTRayINI + ' to ' + szLAUTrayAppPath);
|
||||
except
|
||||
except
|
||||
On E: Exception do
|
||||
WriteAndLog(Format('Could not copy %s. Error: %s ', [C_LAUTrayApp, E.Message]));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
// If CopyTree, then just copy the whole of the /updates folder (inc directories) to the App Directory
|
||||
try
|
||||
try
|
||||
if ParamStrUTF8(5) = 'copytree' then
|
||||
// Copy a whole directory tree?
|
||||
bCopyTreeSuccess := CopyDirTree(szUpdatesFullPath, ProgramDirectory,
|
||||
[cffOverwriteFile, cffCreateDestDirectory]);
|
||||
except
|
||||
except
|
||||
On E: Exception do
|
||||
WriteAndLog('Copytree error: ' + E.Message);
|
||||
end;
|
||||
end;
|
||||
|
||||
// CopyTree not specified, or operation failed
|
||||
// Just copy the updated app over the old one
|
||||
if FileExistsUTF8(szUpdatedEXEPath) then
|
||||
begin
|
||||
begin
|
||||
if (bCopyTreeSuccess = False) then
|
||||
// Copy over exe file
|
||||
if Fileutil.CopyFile(szUpdatedEXEPath, szOldEXEPath, [cffOverWriteFile]) then
|
||||
begin
|
||||
begin
|
||||
WriteAndLog('Copying over executeable, then sleeping...');
|
||||
{$IFDEF HAS_SLEEP}
|
||||
WriteAndLog('Sleeping...');
|
||||
@ -305,27 +315,27 @@ begin
|
||||
WriteAndLog('Waiting 1 second...');
|
||||
WaitFor(1000);
|
||||
{$ENDIF}
|
||||
end
|
||||
end
|
||||
else
|
||||
WriteAndLog('Copy to ' + szUpdatedEXEPath + ' failed');
|
||||
|
||||
// Restart updated app
|
||||
if FileExistsUTF8(szOldEXEPath) then
|
||||
begin
|
||||
begin
|
||||
WriteAndLog('Restarting ' + szPrettyName + '...');
|
||||
AppProcess := TProcess.Create(nil);
|
||||
try
|
||||
try
|
||||
AppProcess.CurrentDirectory := ExtractFileDir(szOldEXEPath);
|
||||
AppProcess.Executable := szOldEXEPath;
|
||||
AppProcess.StartupOptions := [suoUseShowWindow];
|
||||
AppProcess.Execute;
|
||||
finally
|
||||
finally
|
||||
AppProcess.Free;
|
||||
end;
|
||||
end
|
||||
end;
|
||||
end
|
||||
else
|
||||
WriteAndLog('Failure. Couldn''t find ' + szOldEXEPath);
|
||||
end
|
||||
end
|
||||
else
|
||||
WriteAndLog('Failure. Couldn''t find ' + szUpdatedEXEPath);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
object mainform: Tmainform
|
||||
Left = 767
|
||||
Left = 715
|
||||
Height = 481
|
||||
Top = 215
|
||||
Top = 197
|
||||
Width = 587
|
||||
AllowDropFiles = True
|
||||
BorderIcons = [biSystemMenu, biMinimize]
|
||||
@ -188,6 +188,7 @@ object mainform: Tmainform
|
||||
OnCloseUp = cmb_profileCloseUp
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
Sorted = True
|
||||
Style = csDropDownList
|
||||
TabOrder = 0
|
||||
Text = 'Default'
|
||||
|
@ -36,7 +36,7 @@ unit umainform;
|
||||
interface
|
||||
|
||||
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,
|
||||
eventlog, umemoform, Zipper, strutils, asyncprocess, lclintf, types;
|
||||
|
||||
@ -196,7 +196,7 @@ type
|
||||
procedure spn3Change(Sender: TObject);
|
||||
procedure spn4Change(Sender: TObject);
|
||||
procedure tab_configureContextPopup(Sender: TObject; MousePos: TPoint;
|
||||
var Handled: Boolean);
|
||||
var Handled: boolean);
|
||||
private
|
||||
{ private declarations }
|
||||
AppConfig: TINIFile; // Application config file. Holds current Profile name
|
||||
@ -205,7 +205,8 @@ type
|
||||
ProfilenameList: TStringList; // Used to populate the combo box
|
||||
szCurrentProfileName: string; // Name used to Save/Load profiles to the INI file
|
||||
bCurrentProfileSaved, bComponentDownloaded, bIsVirgin: boolean;
|
||||
bShowCodeWindow, bShowFileManager, bShowOnlineWebsite, bOverRideUserPrefs,DebugMode: boolean;
|
||||
bShowCodeWindow, bShowFileManager, bShowOnlineWebsite,
|
||||
bOverRideUserPrefs, DebugMode: boolean;
|
||||
// DragFileStringList:TStringList;
|
||||
procedure ReadProfileFromINI(AProfileName: string); // Writes ProfileRec to disk
|
||||
procedure WriteProfileToINI(AProfileName: string); // Reads ProfileRec from disk
|
||||
@ -358,19 +359,21 @@ begin
|
||||
end;
|
||||
|
||||
procedure Tmainform.tab_configureContextPopup(Sender: TObject;
|
||||
MousePos: TPoint; var Handled: Boolean);
|
||||
MousePos: TPoint; var Handled: boolean);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormCreate(Sender: TObject);
|
||||
begin
|
||||
If LowerCase(ParamStr(1))='debug' then DebugMode:=TRUE
|
||||
else DebugMode:=FALSE;
|
||||
if LowerCase(ParamStr(1)) = 'debug' then
|
||||
DebugMode := True
|
||||
else
|
||||
DebugMode := False;
|
||||
Caption := Application.Title;
|
||||
Icon := Application.Icon;
|
||||
AppConfig := TINIFile.Create(GetAppConfigDir(false) + C_APPCONFIGNAME);
|
||||
ProfileConfig := TINIFile.Create(GetAppConfigDir(false) + C_PROFILECONFIGNAME);
|
||||
AppConfig := TINIFile.Create(GetAppConfigDir(False) + C_APPCONFIGNAME);
|
||||
ProfileConfig := TINIFile.Create(GetAppConfigDir(False) + C_PROFILECONFIGNAME);
|
||||
ProfilenameList := TStringList.Create;
|
||||
ProfileRec.DragFileStringList := TStringList.Create;
|
||||
if FileExistsUTF8('readme.txt') then
|
||||
@ -416,18 +419,22 @@ begin
|
||||
cmb_profile.Clear;
|
||||
cmb_profile.Items := ProfileNameList;
|
||||
cmb_profile.ItemIndex := cmb_profile.Items.IndexOf(szCurrentProfileName);
|
||||
If LazAutoUpdate1.CreateLocalLauImportFile
|
||||
then LazAutoUpdate1.RelocateLauImportFile;
|
||||
if LazAutoUpdate1.CreateLocalLauImportFile then
|
||||
LazAutoUpdate1.RelocateLauImportFile;
|
||||
if bIsVirgin then
|
||||
PageControl1.ActivePage := tab_intro
|
||||
else
|
||||
PageControl1.ActivePage := tab_configure;
|
||||
If DebugMode then EventLog1.FileName := ChangeFileExt(ParamStr(0), '.log');
|
||||
If DebugMode then if FileExistsUTF8(EventLog1.FileName) then
|
||||
SysUtils.DeleteFile(EventLog1.FileName);
|
||||
If DebugMode then EventLog1.AppendContent := True;
|
||||
If DebugMode then EventLog1.Active := True;
|
||||
LazAutoUpdate1.DebugMode:=DebugMode;
|
||||
if DebugMode then
|
||||
EventLog1.FileName := ChangeFileExt(ParamStr(0), '.log');
|
||||
if DebugMode then
|
||||
if FileExistsUTF8(EventLog1.FileName) then
|
||||
SysUtils.DeleteFile(EventLog1.FileName);
|
||||
if DebugMode then
|
||||
EventLog1.AppendContent := True;
|
||||
if DebugMode then
|
||||
EventLog1.Active := True;
|
||||
LazAutoUpdate1.DebugMode := DebugMode;
|
||||
end;
|
||||
|
||||
procedure Tmainform.FormDestroy(Sender: TObject);
|
||||
@ -453,10 +460,10 @@ var
|
||||
begin
|
||||
for i := Low(FileNames) to High(FileNames) do
|
||||
if ((ProfileRec.DragFileStringList.IndexOf(FileNames[i]) = -1) and
|
||||
(FileNames[i] <> ProfileRec.AppPath) and (FileNames[i] <>
|
||||
ProfileRec.WhatsNewPath) and (FileNames[i] <>
|
||||
LazAutoUpdate1.UpdateExe) and (FileNames[i] <>
|
||||
LazAutoUpdate1.UpdateExeSilent)) then
|
||||
(FileNames[i] <> ProfileRec.AppPath) and
|
||||
(FileNames[i] <> ProfileRec.WhatsNewPath) and
|
||||
(FileNames[i] <> LazAutoUpdate1.UpdateExe) and
|
||||
(FileNames[i] <> LazAutoUpdate1.UpdateExeSilent)) then
|
||||
if (DirPathExists(FileNames[i]) = True) then
|
||||
begin // Not allowed to drag a directory into the list
|
||||
ShowMessage('You dragged a directory. For whole directories, use the CopyTree facility');
|
||||
@ -483,7 +490,8 @@ end;
|
||||
|
||||
procedure Tmainform.LazAutoUpdate1DebugEvent(Sender: TObject; WhereAt, Message: string);
|
||||
begin
|
||||
If DebugMode AND (EventLog1.Active=TRUE) then EventLog1.Log(Format('LazAutoUpdate: Source=%s, Message=%s', [WhereAt, Message]));
|
||||
if DebugMode and (EventLog1.Active = True) then
|
||||
EventLog1.Log(Format('LazAutoUpdate: Source=%s, Message=%s', [WhereAt, Message]));
|
||||
end;
|
||||
|
||||
procedure Tmainform.lst_dragfilesDblClick(Sender: TObject);
|
||||
@ -681,7 +689,8 @@ begin
|
||||
CanClose := True;
|
||||
end;
|
||||
if CanClose then
|
||||
If DebugMode then EventLog1.Active := False;
|
||||
if DebugMode then
|
||||
EventLog1.Active := False;
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmd_UseAppnameVersionsINIClick(Sender: TObject);
|
||||
@ -715,7 +724,7 @@ begin
|
||||
ZipFileName := 'packagesource.zip';
|
||||
ShowUpdateInCaption := True;
|
||||
VersionINI := TIniFile.Create('new' + VersionsININame);
|
||||
// VersionINI := TIniFile.Create(VersionsININame);
|
||||
// VersionINI := TIniFile.Create(VersionsININame);
|
||||
AppVersion := VersionINI.ReadString('versions', 'GUI', '0.0.0.0');
|
||||
VersionINI.Free;
|
||||
if NewVersionAvailable then
|
||||
@ -750,22 +759,22 @@ end;
|
||||
|
||||
procedure Tmainform.cmb_profileClick(Sender: TObject);
|
||||
begin
|
||||
szCurrentProfileName := cmb_profile.Items[cmb_profile.ItemIndex];
|
||||
// Auto-save current profile
|
||||
AppConfig.WriteString('Current', 'Profilename', szCurrentProfileName);
|
||||
ReadFromGUI(szCurrentProfileName); // Read from GUI
|
||||
WriteProfileToINI(szCurrentProfileName); // Write to disk
|
||||
bCurrentProfileSaved := True;
|
||||
szCurrentProfileName := cmb_profile.Items[cmb_profile.ItemIndex];
|
||||
// Auto-save current profile
|
||||
AppConfig.WriteString('Current', 'Profilename', szCurrentProfileName);
|
||||
ReadFromGUI(szCurrentProfileName); // Read from GUI
|
||||
WriteProfileToINI(szCurrentProfileName); // Write to disk
|
||||
bCurrentProfileSaved := True;
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmb_profileCloseUp(Sender: TObject);
|
||||
begin
|
||||
// Read selected profile into ProfileRec and GUI
|
||||
szCurrentProfileName := cmb_profile.Items[cmb_profile.ItemIndex];
|
||||
ReadProfileFromINI(szCurrentProfileName); // Read from disk
|
||||
WriteToGUI(szCurrentProfileName); // Display in GUI
|
||||
AppConfig.WriteString('Current', 'Profilename', szCurrentProfileName);
|
||||
bCurrentProfileSaved := False;
|
||||
// Read selected profile into ProfileRec and GUI
|
||||
szCurrentProfileName := cmb_profile.Items[cmb_profile.ItemIndex];
|
||||
ReadProfileFromINI(szCurrentProfileName); // Read from disk
|
||||
WriteToGUI(szCurrentProfileName); // Display in GUI
|
||||
AppConfig.WriteString('Current', 'Profilename', szCurrentProfileName);
|
||||
bCurrentProfileSaved := False;
|
||||
|
||||
end;
|
||||
|
||||
@ -923,12 +932,13 @@ begin
|
||||
Execute;
|
||||
end;
|
||||
if bShowOnlineWebsite then
|
||||
If LazAutoUpdate1.ProjectType=auSourceForge then
|
||||
OpenURL('https://sourceforge.net/projects/' + ProfileRec.SFProjectName + '/');
|
||||
If LazAutoUpdate1.ProjectType=auGitHubReleaseZip then
|
||||
OpenURL('https://github.com/' + LazAutoUpdate1.GitHubProjectName + '/' + LazAutoUpdate1.GitHubBranchOrTag + '/');
|
||||
If LazAutoUpdate1.ProjectType=auOther then
|
||||
OpenURL(LazAutoUpdate1.auOtherSourceURL + '/');
|
||||
if LazAutoUpdate1.ProjectType = auSourceForge then
|
||||
OpenURL('https://sourceforge.net/projects/' + ProfileRec.SFProjectName + '/');
|
||||
if LazAutoUpdate1.ProjectType = auGitHubReleaseZip then
|
||||
OpenURL('https://github.com/' + LazAutoUpdate1.GitHubProjectName +
|
||||
'/' + LazAutoUpdate1.GitHubBranchOrTag + '/');
|
||||
if LazAutoUpdate1.ProjectType = auOther then
|
||||
OpenURL(LazAutoUpdate1.auOtherSourceURL + '/');
|
||||
|
||||
{$ELSE}
|
||||
// Use generic linux command
|
||||
@ -941,12 +951,14 @@ begin
|
||||
if bShowFileManager then
|
||||
Execute;
|
||||
Parameters.Clear;
|
||||
If LazAutoUpdate1.ProjectType=auSourceForge then
|
||||
Parameters.Add('https://sourceforge.net/projects/' + ProfileRec.SFProjectName + '/');
|
||||
If LazAutoUpdate1.ProjectType=auGitHubReleaseZip then
|
||||
Parameters.Add('https://github.com/' + LazAutoUpdate1.GitHubProjectName + '/' + LazAutoUpdate1.GitHubBranchOrTag + '/');
|
||||
If LazAutoUpdate1.ProjectType=auOther then
|
||||
Parameters.Add(LazAutoUpdate1.auOtherSourceURL + '/');
|
||||
if LazAutoUpdate1.ProjectType = auSourceForge then
|
||||
Parameters.Add('https://sourceforge.net/projects/' +
|
||||
ProfileRec.SFProjectName + '/');
|
||||
if LazAutoUpdate1.ProjectType = auGitHubReleaseZip then
|
||||
Parameters.Add('https://github.com/' + LazAutoUpdate1.GitHubProjectName +
|
||||
'/' + LazAutoUpdate1.GitHubBranchOrTag + '/');
|
||||
if LazAutoUpdate1.ProjectType = auOther then
|
||||
Parameters.Add(LazAutoUpdate1.auOtherSourceURL + '/');
|
||||
if bShowOnlineWebsite then
|
||||
Execute;
|
||||
end;
|
||||
@ -962,13 +974,15 @@ begin
|
||||
end;
|
||||
|
||||
procedure Tmainform.cmd_NewProfileClick(Sender: TObject);
|
||||
Var
|
||||
szProfileName:String;
|
||||
var
|
||||
szProfileName: string;
|
||||
begin
|
||||
szProfileName := '';
|
||||
if NOT InputQuery('New Profile Name',
|
||||
'Type new profile name here',FALSE,szProfilename) then exit;
|
||||
if szProfileName = '' then exit;
|
||||
if not InputQuery('New Profile Name', 'Type new profile name here',
|
||||
False, szProfilename) then
|
||||
exit;
|
||||
if szProfileName = '' then
|
||||
exit;
|
||||
|
||||
// We have a valid profile name...
|
||||
// Does it already exist?
|
||||
@ -985,8 +999,13 @@ begin
|
||||
// Set last item in list as current
|
||||
cmb_profile.ItemIndex := cmb_profile.Items.Count - 1;
|
||||
bCurrentProfileSaved := False;
|
||||
end
|
||||
else
|
||||
begin
|
||||
ShowMessage('This profile name already exists. Please choose a new name');
|
||||
Exit;
|
||||
end;
|
||||
if (ProfilenameList.IndexOf(cmb_profile.Text) >= 0) then
|
||||
if (ProfilenameList.IndexOf(cmb_profile.Text) >= 0) then
|
||||
MessageDlg(Application.Title,
|
||||
Format(rsNewProfileCreated, [szCurrentProfileName]),
|
||||
mtInformation, [mbOK], 0);
|
||||
@ -1023,7 +1042,8 @@ begin
|
||||
begin
|
||||
ProfileName := AProfileName;
|
||||
AppPath := ReadString(AProfileName, 'AppPath', ProgramDirectory + 'myapp.exe');
|
||||
OutDir := CleanAndExpandDirectory(ReadString(AProfileName, 'OutDir', ProgramDirectory));
|
||||
OutDir := CleanAndExpandDirectory(ReadString(AProfileName,
|
||||
'OutDir', ProgramDirectory));
|
||||
NewVersion.VString := ReadString(AProfileName, 'NewVersion', '0.0.0.0');
|
||||
FillVersionInteger(NewVersion);
|
||||
VersionsINI := ReadString(AProfileName, 'VersionsINI', 'versions.ini');
|
||||
@ -1228,7 +1248,8 @@ begin
|
||||
DeleteFile(ProfileRec.Zipfilename);
|
||||
Application.ProcessMessages;
|
||||
if FileExistsUTF8(ProfileRec.Zipfilename) then
|
||||
If DebugMode then EventLog1.Error('Unable to delete %s', [ProfileRec.Zipfilename]);
|
||||
if DebugMode then
|
||||
EventLog1.Error('Unable to delete %s', [ProfileRec.Zipfilename]);
|
||||
end;
|
||||
|
||||
AZipper := TZipper.Create;
|
||||
@ -1326,7 +1347,8 @@ begin
|
||||
DeleteFile(ProfileRec.Outdir + C_LAUTRayINI);
|
||||
Application.ProcessMessages;
|
||||
if FileExistsUTF8(ProfileRec.Outdir + C_LAUTRayINI) then
|
||||
If DebugMode then EventLog1.Error('Unable to delete %s', [ProfileRec.Outdir + C_LAUTRayINI]);
|
||||
if DebugMode then
|
||||
EventLog1.Error('Unable to delete %s', [ProfileRec.Outdir + C_LAUTRayINI]);
|
||||
|
||||
LAUTRayINI := TINIFile.Create(ProfileRec.Outdir + C_LAUTRayINI);
|
||||
try
|
||||
|
@ -23,7 +23,7 @@
|
||||
<UseVersionInfo Value="True"/>
|
||||
<MajorVersionNr Value="1"/>
|
||||
<MinorVersionNr Value="2"/>
|
||||
<RevisionNr Value="2"/>
|
||||
<RevisionNr Value="3"/>
|
||||
<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>
|
||||
<BuildModes Count="5">
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user