1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-02-07 10:40:19 -05:00

Changes in the updater.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@356 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2010-01-01 15:32:23 +00:00
parent b9fedf3d0b
commit 1e62434a2e
8 changed files with 125 additions and 72 deletions

View File

@ -38,7 +38,7 @@
<CursorPos X="7" Y="124"/> <CursorPos X="7" Y="124"/>
<TopLine Value="99"/> <TopLine Value="99"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="120"/> <UsageCount Value="121"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -271,8 +271,8 @@
<Unit30> <Unit30>
<Filename Value="../../Units/MMLAddon/updater.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<UnitName Value="updater"/> <UnitName Value="updater"/>
<CursorPos X="13" Y="157"/> <CursorPos X="18" Y="199"/>
<TopLine Value="139"/> <TopLine Value="174"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<UsageCount Value="15"/> <UsageCount Value="15"/>
<Loaded Value="True"/> <Loaded Value="True"/>

View File

@ -8,7 +8,7 @@
</Flags> </Flags>
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/> <Title Value="Simba"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="12"/> <ActiveEditorIndexAtStart Value="12"/>
</General> </General>
@ -282,8 +282,8 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/> <UnitName Value="mmlpsthread"/>
<CursorPos X="1" Y="99"/> <CursorPos X="20" Y="193"/>
<TopLine Value="67"/> <TopLine Value="174"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -603,9 +603,11 @@
</Unit79> </Unit79>
<Unit80> <Unit80>
<Filename Value="../../Units/MMLAddon/PSInc/psdefines.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psdefines.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="55" Y="18"/>
<TopLine Value="1"/> <TopLine Value="2"/>
<UsageCount Value="7"/> <EditorIndex Value="13"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit80> </Unit80>
<Unit81> <Unit81>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/math.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/math.inc"/>
@ -1433,8 +1435,8 @@
<ComponentName Value="ColourHistoryForm"/> <ComponentName Value="ColourHistoryForm"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="colourhistory"/> <UnitName Value="colourhistory"/>
<CursorPos X="71" Y="503"/> <CursorPos X="66" Y="23"/>
<TopLine Value="486"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -1687,7 +1689,7 @@
<UnitName Value="about"/> <UnitName Value="about"/>
<CursorPos X="44" Y="21"/> <CursorPos X="44" Y="21"/>
<TopLine Value="4"/> <TopLine Value="4"/>
<UsageCount Value="168"/> <UsageCount Value="171"/>
</Unit235> </Unit235>
<Unit236> <Unit236>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
@ -1702,7 +1704,7 @@
<CursorPos X="5" Y="14"/> <CursorPos X="5" Y="14"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="8"/> <EditorIndex Value="8"/>
<UsageCount Value="162"/> <UsageCount Value="165"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit237> </Unit237>
<Unit238> <Unit238>
@ -1712,7 +1714,7 @@
<UnitName Value="debugimageform"/> <UnitName Value="debugimageform"/>
<CursorPos X="20" Y="1"/> <CursorPos X="20" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="149"/> <UsageCount Value="152"/>
</Unit238> </Unit238>
<Unit239> <Unit239>
<Filename Value="debugimage.pas"/> <Filename Value="debugimage.pas"/>
@ -1722,7 +1724,7 @@
<UnitName Value="debugimage"/> <UnitName Value="debugimage"/>
<CursorPos X="66" Y="17"/> <CursorPos X="66" Y="17"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="148"/> <UsageCount Value="151"/>
</Unit239> </Unit239>
<Unit240> <Unit240>
<Filename Value="debugimage.lrs"/> <Filename Value="debugimage.lrs"/>
@ -1844,7 +1846,7 @@
<UnitName Value="framefunctionlist"/> <UnitName Value="framefunctionlist"/>
<CursorPos X="56" Y="9"/> <CursorPos X="56" Y="9"/>
<TopLine Value="54"/> <TopLine Value="54"/>
<UsageCount Value="69"/> <UsageCount Value="72"/>
</Unit257> </Unit257>
<Unit258> <Unit258>
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/> <Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
@ -1899,7 +1901,7 @@
<UnitName Value="simpleanalyzer"/> <UnitName Value="simpleanalyzer"/>
<CursorPos X="52" Y="104"/> <CursorPos X="52" Y="104"/>
<TopLine Value="193"/> <TopLine Value="193"/>
<UsageCount Value="56"/> <UsageCount Value="59"/>
</Unit265> </Unit265>
<Unit266> <Unit266>
<Filename Value="../../Units/Misc/mPasLex.pas"/> <Filename Value="../../Units/Misc/mPasLex.pas"/>
@ -1955,7 +1957,7 @@
<CursorPos X="59" Y="19"/> <CursorPos X="59" Y="19"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="10"/> <EditorIndex Value="10"/>
<UsageCount Value="15"/> <UsageCount Value="16"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit273> </Unit273>
<Unit274> <Unit274>
@ -1963,7 +1965,7 @@
<CursorPos X="39" Y="4"/> <CursorPos X="39" Y="4"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="9"/> <EditorIndex Value="9"/>
<UsageCount Value="15"/> <UsageCount Value="16"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit274> </Unit274>
<Unit275> <Unit275>
@ -1971,7 +1973,7 @@
<CursorPos X="87" Y="133"/> <CursorPos X="87" Y="133"/>
<TopLine Value="111"/> <TopLine Value="111"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="15"/> <UsageCount Value="16"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit275> </Unit275>
<Unit276> <Unit276>
@ -1985,10 +1987,10 @@
<Filename Value="../../Units/MMLAddon/updater.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="updater"/> <UnitName Value="updater"/>
<CursorPos X="88" Y="194"/> <CursorPos X="63" Y="156"/>
<TopLine Value="165"/> <TopLine Value="129"/>
<EditorIndex Value="14"/> <EditorIndex Value="15"/>
<UsageCount Value="29"/> <UsageCount Value="32"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit277> </Unit277>
<Unit278> <Unit278>
@ -1997,10 +1999,10 @@
<ComponentName Value="SimbaUpdateForm"/> <ComponentName Value="SimbaUpdateForm"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="updateform"/> <UnitName Value="updateform"/>
<CursorPos X="6" Y="82"/> <CursorPos X="80" Y="91"/>
<TopLine Value="69"/> <TopLine Value="78"/>
<EditorIndex Value="12"/> <EditorIndex Value="12"/>
<UsageCount Value="24"/> <UsageCount Value="27"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit278> </Unit278>
<Unit279> <Unit279>
@ -2008,8 +2010,8 @@
<UnitName Value="FileUtil"/> <UnitName Value="FileUtil"/>
<CursorPos X="53" Y="95"/> <CursorPos X="53" Y="95"/>
<TopLine Value="67"/> <TopLine Value="67"/>
<EditorIndex Value="13"/> <EditorIndex Value="14"/>
<UsageCount Value="10"/> <UsageCount Value="11"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit279> </Unit279>
<Unit280> <Unit280>
@ -2051,8 +2053,8 @@
<UnitName Value="UnixUtils"/> <UnitName Value="UnixUtils"/>
<CursorPos X="17" Y="62"/> <CursorPos X="17" Y="62"/>
<TopLine Value="56"/> <TopLine Value="56"/>
<EditorIndex Value="15"/> <EditorIndex Value="16"/>
<UsageCount Value="10"/> <UsageCount Value="11"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit285> </Unit285>
<Unit286> <Unit286>
@ -2068,7 +2070,7 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit287> </Unit287>
</Units> </Units>
<JumpHistory Count="8" HistoryIndex="7"> <JumpHistory Count="14" HistoryIndex="13">
<Position1> <Position1>
<Filename Value="updateform.pas"/> <Filename Value="updateform.pas"/>
<Caret Line="37" Column="29" TopLine="19"/> <Caret Line="37" Column="29" TopLine="19"/>
@ -2101,6 +2103,30 @@
<Filename Value="../../Units/MMLAddon/updater.pas"/> <Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="194" Column="89" TopLine="177"/> <Caret Line="194" Column="89" TopLine="177"/>
</Position8> </Position8>
<Position9>
<Filename Value="updateform.pas"/>
<Caret Line="9" Column="28" TopLine="1"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="138" Column="70" TopLine="125"/>
</Position10>
<Position11>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="193" Column="20" TopLine="174"/>
</Position11>
<Position12>
<Filename Value="../../Units/MMLAddon/PSInc/psdefines.inc"/>
<Caret Line="27" Column="12" TopLine="2"/>
</Position12>
<Position13>
<Filename Value="updateform.pas"/>
<Caret Line="9" Column="28" TopLine="1"/>
</Position13>
<Position14>
<Filename Value="../../Units/MMLAddon/updater.pas"/>
<Caret Line="169" Column="15" TopLine="151"/>
</Position14>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -30,14 +30,11 @@ uses
cthreads, cmem, cthreads, cmem,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, LResources, testunit, colourhistory, About, internets, debugimage, Forms, testunit, colourhistory, About, internets, debugimage,
framefunctionlist, simpleanalyzer, updater, updateform; framefunctionlist, simpleanalyzer, updater, updateform;
{$IFDEF WINDOWS}{$R project1.rc}{$ENDIF}
begin begin
{$I project1.lrs} Application.Title:='Simba';
Application.Title:='Mufasa Stand Alone';
Application.Initialize; Application.Initialize;
Application.CreateForm(TForm1, Form1); Application.CreateForm(TForm1, Form1);

View File

@ -3,6 +3,7 @@ object SimbaUpdateForm: TSimbaUpdateForm
Height = 391 Height = 391
Top = 242 Top = 242
Width = 467 Width = 467
ActiveControl = UpdateButton
Caption = 'SimbaUpdateForm' Caption = 'SimbaUpdateForm'
ClientHeight = 391 ClientHeight = 391
ClientWidth = 467 ClientWidth = 467

View File

@ -2,19 +2,19 @@
LazarusResources.Add('TSimbaUpdateForm','FORMDATA',[ LazarusResources.Add('TSimbaUpdateForm','FORMDATA',[
'TPF0'#16'TSimbaUpdateForm'#15'SimbaUpdateForm'#4'Left'#3#131#1#6'Height'#3 'TPF0'#16'TSimbaUpdateForm'#15'SimbaUpdateForm'#4'Left'#3#131#1#6'Height'#3
+#135#1#3'Top'#3#242#0#5'Width'#3#211#1#7'Caption'#6#15'SimbaUpdateForm'#12'C' +#135#1#3'Top'#3#242#0#5'Width'#3#211#1#13'ActiveControl'#7#12'UpdateButton'#7
+'lientHeight'#3#135#1#11'ClientWidth'#3#211#1#10'LCLVersion'#6#6'0.9.29'#0#12 +'Caption'#6#15'SimbaUpdateForm'#12'ClientHeight'#3#135#1#11'ClientWidth'#3
+'TProgressBar'#16'DownloadProgress'#4'Left'#2#24#6'Height'#2#28#3'Top'#2'H'#5 +#211#1#10'LCLVersion'#6#6'0.9.29'#0#12'TProgressBar'#16'DownloadProgress'#4
+'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#6'Smooth'#9#8 +'Left'#2#24#6'Height'#2#28#3'Top'#2'H'#5'Width'#3#157#1#7'Anchors'#11#5'akTo'
+'TabOrder'#2#0#0#0#7'TButton'#12'UpdateButton'#4'Left'#2#24#6'Height'#2#25#3 +'p'#6'akLeft'#7'akRight'#0#6'Smooth'#9#8'TabOrder'#2#0#0#0#7'TButton'#12'Upd'
+'Top'#2' '#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7 +'ateButton'#4'Left'#2#24#6'Height'#2#25#3'Top'#2' '#5'Width'#3#157#1#7'Ancho'
+'Caption'#6#7'Update!'#7'OnClick'#7#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0 +'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#7'Update!'#7'OnClick'#7
+#7'TButton'#8'OkButton'#4'Left'#3'j'#1#6'Height'#2#25#3'Top'#3'X'#1#5'Width' +#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'#8'OkButton'#4'Left'#3
+#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7 +'j'#1#6'Height'#2#25#3'Top'#3'X'#1#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8
+#13'OkButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#12'CancelButton'#4'Left'#2 +'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2
+#24#6'Height'#2#25#3'Top'#3'X'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akB' +#2#0#0#7'TButton'#12'CancelButton'#4'Left'#2#24#6'Height'#2#25#3'Top'#3'X'#1
+'ottom'#0#7'Caption'#6#6'Cancel'#7'OnClick'#7#17'CancelButtonClick'#8'TabOrd' +#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Cancel'#7
+'er'#2#3#0#0#5'TMemo'#9'UpdateLog'#4'Left'#2#24#6'Height'#3#199#0#3'Top'#3 +'OnClick'#7#17'CancelButtonClick'#8'TabOrder'#2#3#0#0#5'TMemo'#9'UpdateLog'#4
+#128#0#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBott' +'Left'#2#24#6'Height'#3#199#0#3'Top'#3#128#0#5'Width'#3#157#1#7'Anchors'#11#5
+'om'#0#8'TabOrder'#2#4#0#0#0 +'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOrder'#2#4#0#0#0
]); ]);

View File

@ -82,13 +82,17 @@ procedure TSimbaUpdateForm.PerformUpdate;
begin begin
Updater := TMMLFileDownloader.Create; Updater := TMMLFileDownloader.Create;
FCancelling := False;
FCancelled := False;
// Make this a setting later // Make this a setting later
Updater.FileURL := 'http://old.villavu.com/merlijn/Simba'; Updater.FileURL := 'http://old.villavu.com/merlijn/Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF};
// Dynamic // Dynamic
Updater.ReplacementFile := 'Simba';
Updater.OnBeat:=@Self.OnUpdateBeat; Updater.ReplacementFile := ApplicationName{$IFDEF WINDOWS} +'.exe'{$ENDIF};
Updater.OnBeat := @Self.OnUpdateBeat;
Self.UpdateLog.Lines.Add('Starting download of ' + Updater.FileURL + ' ...'); Self.UpdateLog.Lines.Add('Starting download of ' + Updater.FileURL + ' ...');
try try
@ -103,6 +107,7 @@ begin
FCancelling := False; FCancelling := False;
FCancelled := True; FCancelled := True;
Self.UpdateLog.Lines.Add('Download stopped ...'); Self.UpdateLog.Lines.Add('Download stopped ...');
// more detailed info
writeln('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files'); writeln('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files');
end; end;
Self.UpdateLog.Lines.Add('Done ...'); Self.UpdateLog.Lines.Add('Done ...');

View File

@ -26,6 +26,7 @@ PSScript.Defines.Add('CPU386');
{$ENDIF } {$ENDIF }
PSScript.Defines.Add('MUFASA'); PSScript.Defines.Add('MUFASA');
PSScript.Defines.Add('COGAT'); PSScript.Defines.Add('COGAT');
PSScript.Defines.Add('SIMBA');
PSScript.Defines.Add('RAYMONDPOWNS'); PSScript.Defines.Add('RAYMONDPOWNS');
{$IFDEF MSWINDOWS } {$IFDEF MSWINDOWS }
PSScript.Defines.Add('MSWINDOWS'); PSScript.Defines.Add('MSWINDOWS');

View File

@ -5,7 +5,10 @@ unit updater;
interface interface
uses uses
Classes, SysUtils, httpsend,blcksock; Classes, SysUtils, httpsend,blcksock
{$IFDEF LINUX}
,unixutils // for chmod
{$ENDIF};
type type
{ TMMLUpdateThread = class(TThread) { TMMLUpdateThread = class(TThread)
@ -14,7 +17,7 @@ type
destructor Destroy; override; destructor Destroy; override;
end; } end; }
TMemory = pointer; TMemory = pointer;
TFunctionBoolean = function: boolean; TMMLFunctionBoolean = function: boolean of object;
TMMLFileDownloader = class(TObject) TMMLFileDownloader = class(TObject)
@ -25,8 +28,8 @@ type
HTTPSend: THTTPSend; HTTPSend: THTTPSend;
FFileSize: Integer; FFileSize: Integer;
FDownloaded: Boolean; FDownloaded: Boolean;
FOnChange: TFunctionBoolean; FOnChange: TMMLFunctionBoolean;
FOnBeat: TFunctionBoolean; FOnBeat: TMMLFunctionBoolean;
public public
constructor Create; constructor Create;
@ -53,10 +56,10 @@ type
{ If either of these events return "True", an exception is thrown { If either of these events return "True", an exception is thrown
and the download is cancelled. This way we can easily `cancel' and the download is cancelled. This way we can easily `cancel'
a download. } a download. }
property OnChange: TFunctionBoolean read FOnChange write FOnChange; property OnChange: TMMLFunctionBoolean read FOnChange write FOnChange;
{ Called every 50ms } { Called every 50ms }
property OnBeat: TFunctionBoolean read FOnBeat write FOnBeat; property OnBeat: TMMLFunctionBoolean read FOnBeat write FOnBeat;
function GetPercentage: Integer; function GetPercentage: Integer;
private private
@ -105,7 +108,7 @@ procedure TMMLFileDownloader.OnHeartBeat(Sender: TObject);
begin begin
if Assigned(FOnBeat) then if Assigned(FOnBeat) then
if FOnBeat() then if FOnBeat() then
raise Exception.Create('OnChange event called for a quit'); raise Exception.Create('OnBeat event called for a quit');
end; end;
procedure TMMLFileDownloader.OnMonitor(Sender: TObject; Writing: Boolean; procedure TMMLFileDownloader.OnMonitor(Sender: TObject; Writing: Boolean;
@ -122,7 +125,6 @@ begin
if Assigned(FOnChange) then if Assigned(FOnChange) then
if FOnChange() then if FOnChange() then
raise Exception.Create('OnChange event called for a quit'); raise Exception.Create('OnChange event called for a quit');
// writeln('Percent done: ' + IntToStr(GetPercentage));
end; end;
function TMMLFileDownloader.GetPercentage: Integer; function TMMLFileDownloader.GetPercentage: Integer;
@ -165,25 +167,48 @@ begin
FDownloaded := True; FDownloaded := True;
except except
writeln('DownloadAndSave: Exception Occured'); writeln('DownloadAndSave: Exception Occured');
HTTPSend.Free; Result := False;
Response.Free;
end; end;
HTTPSend.Free;
Response.Free;
if not result then
Raise Exception.Create('Throwing it so we can catch it later');
end; end;
function TMMLFileDownloader.Replace: Boolean; function TMMLFileDownloader.Replace: Boolean;
begin begin
{ Change to messages + Exit(False) instead of exceptions? }
if not Downloaded then if not Downloaded then
raise Exception.Create('Nothing downloaded'); begin
writeln('Nothing downloaded');
exit(False);
// raise Exception.Create('Nothing downloaded');
end;
if FReplacementFile = '' then if FReplacementFile = '' then
raise Exception.Create('ReplacementFile not set'); begin
writeln('ReplacementFile not se');
exit(False);
//raise Exception.Create('ReplacementFile not set');
end;
if not FileExists(FReplacementFile) then if not FileExists(FReplacementFile) then
begin
writeln('ReplacementFile not found');
exit(False);
raise Exception.Create('ReplacementFile not found'); raise Exception.Create('ReplacementFile not found');
end;
if not FileExists(FReplacementFile+ '_') then if not FileExists(FReplacementFile+ '_') then
begin
writeln('ReplacementFile + _ not found');
exit(False);
raise Exception.Create('ReplacementFile + _ not found'); raise Exception.Create('ReplacementFile + _ not found');
end;
RenameFile(FReplacementFile, FReplacementFile+'_old_'); RenameFile(FReplacementFile, FReplacementFile+'_old_');
RenameFile(FReplacementFile+'_', FReplacementFile); RenameFile(FReplacementFile+'_', FReplacementFile);
DeleteFile(FReplacementFile+'_old_'); DeleteFile(FReplacementFile+'_old_');
{$IFDEF LINUX}
Chmod(FReplacementFile, PermissionBits[0] or PermissionBits[1] or PermissionBits[2]);
{$ENDIF}
end; end;
constructor TMMLFileDownloader.Create; constructor TMMLFileDownloader.Create;
@ -194,16 +219,14 @@ begin
FDownloaded := False; FDownloaded := False;
FReplacementFile:=''; FReplacementFile:='';
FFileURL := ''; FFileURL := '';
FOnChange := nil;
FOnBeat := nil;
end; end;
destructor TMMLFileDownloader.Destroy; destructor TMMLFileDownloader.Destroy;
begin begin
inherited; inherited;
end; end;