(hopefully) fixed bug where 0 files+dirs were detected

This commit is contained in:
Christian Hammacher 2007-03-05 21:37:48 +00:00
parent bd412d7204
commit 722e97fef2
3 changed files with 34 additions and 34 deletions

Binary file not shown.

View File

@ -296,13 +296,13 @@ var eStr: TStringList;
UpdatePluginsIni: Boolean; UpdatePluginsIni: Boolean;
begin begin
AddStatus('Scanning for directories...', clBlack); AddStatus('Scanning for directories...', clBlack);
with GetAllFiles(ExtractFilePath(ParamStr(0)) + 'files\*.*', faDirectory, True, True) do begin with GetAllFiles(ExtractFilePath(Application.ExeName) + 'files\*.*', faDirectory, True, True) do begin
DirList.Text := Text; DirList.Text := Text;
Free; Free;
end; end;
AddDone('found ' + IntToStr(DirList.Count) + ' directories..'); AddDone('found ' + IntToStr(DirList.Count) + ' directories..');
AddStatus('Scanning for files...', clBlack); AddStatus('Scanning for files...', clBlack);
with GetAllFiles(ExtractFilePath(ParamStr(0)) + 'files\*.*', faAnyFile, True, False) do begin with GetAllFiles(ExtractFilePath(Application.ExeName) + 'files\*.*', faAnyFile, True, False) do begin
FileList.Text := Text; FileList.Text := Text;
Free; Free;
end; end;
@ -343,9 +343,9 @@ begin
end; end;
for i := 0 to DirList.Count -1 do for i := 0 to DirList.Count -1 do
DirList[i] := Copy(DirList[i], Length(ExtractFilePath(ParamStr(0))) + 7, Length(DirList[i])); DirList[i] := Copy(DirList[i], Length(ExtractFilePath(Application.ExeName)) + 7, Length(DirList[i]));
for i := 0 to FileList.Count -1 do for i := 0 to FileList.Count -1 do
FileList[i] := Copy(FileList[i], Length(ExtractFilePath(ParamStr(0))) + 7, Length(FileList[i])); FileList[i] := Copy(FileList[i], Length(ExtractFilePath(Application.ExeName)) + 7, Length(FileList[i]));
{ liblist.gam } { liblist.gam }
if not FileExists(ePath + 'liblist.gam') then begin if not FileExists(ePath + 'liblist.gam') then begin
@ -454,44 +454,44 @@ begin
if not IsForbidden(FileList[i], OS) then begin if not IsForbidden(FileList[i], OS) then begin
if Pos('base', FileList[i]) = 1 then begin if Pos('base', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 6, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 6, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 6, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 6, Length(FileList[i])), CopyConfig);
end; end;
case eMod of case eMod of
modCS: begin modCS: begin
if Pos('cstrike', FileList[i]) = 1 then begin if Pos('cstrike', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 9, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 9, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 9, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 9, Length(FileList[i])), CopyConfig);
end; end;
end; end;
modDoD: begin modDoD: begin
if Pos('dod', FileList[i]) = 1 then begin if Pos('dod', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), CopyConfig);
end; end;
end; end;
modTFC: begin modTFC: begin
if Pos('tfc', FileList[i]) = 1 then begin if Pos('tfc', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), CopyConfig);
end; end;
end; end;
modNS: begin modNS: begin
if Pos('ns', FileList[i]) = 1 then begin if Pos('ns', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), CopyConfig);
end; end;
end; end;
modTS: begin modTS: begin
if Pos('ts', FileList[i]) = 1 then begin if Pos('ts', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), CopyConfig);
end; end;
end; end;
modESF: begin modESF: begin
if Pos('esf', FileList[i]) = 1 then begin if Pos('esf', FileList[i]) = 1 then begin
AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), clBlack); AddStatus('Copying file: addons\amxmodx\' + Copy(FileList[i], 5, Length(FileList[i])), clBlack);
FileCopy(ExtractFilePath(ParamStr(0)) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), CopyConfig); FileCopy(ExtractFilePath(Application.ExeName) + 'files\' + FileList[i], ePath + 'addons\amxmodx\' + Copy(FileList[i], 4, Length(FileList[i])), CopyConfig);
end; end;
end; end;
end; end;
@ -643,13 +643,13 @@ begin
frmMain.cmdNext.Hide; frmMain.cmdNext.Hide;
Screen.Cursor := crHourGlass; Screen.Cursor := crHourGlass;
AddStatus('Scanning for directories...', clBlack); AddStatus('Scanning for directories...', clBlack);
with GetAllFiles(ExtractFilePath(ParamStr(0)) + 'temp\*.*', faDirectory, True, True) do begin with GetAllFiles(ExtractFilePath(Application.ExeName) + 'temp\*.*', faDirectory, True, True) do begin
DirList.Text := Text; DirList.Text := Text;
Free; Free;
end; end;
AddDone('found ' + IntToStr(DirList.Count) + ' directories..'); AddDone('found ' + IntToStr(DirList.Count) + ' directories..');
AddStatus('Scanning for files...', clBlack); AddStatus('Scanning for files...', clBlack);
with GetAllFiles(ExtractFilePath(ParamStr(0)) + 'temp\*.*', faAnyFile, True, False) do begin with GetAllFiles(ExtractFilePath(Application.ExeName) + 'temp\*.*', faAnyFile, True, False) do begin
FileList.Text := Text; FileList.Text := Text;
Free; Free;
end; end;
@ -660,9 +660,9 @@ begin
frmMain.ggeItem.MaxValue := DirList.Count; frmMain.ggeItem.MaxValue := DirList.Count;
for i := 0 to DirList.Count -1 do for i := 0 to DirList.Count -1 do
DirList[i] := Copy(DirList[i], Length(ExtractFilePath(ParamStr(0))) + 6, Length(DirList[i])); DirList[i] := Copy(DirList[i], Length(ExtractFilePath(Application.ExeName)) + 6, Length(DirList[i]));
for i := 0 to FileList.Count -1 do for i := 0 to FileList.Count -1 do
FileList[i] := Copy(FileList[i], Length(ExtractFilePath(ParamStr(0))) + 6, Length(FileList[i])); FileList[i] := Copy(FileList[i], Length(ExtractFilePath(Application.ExeName)) + 6, Length(FileList[i]));
CopyConfig := True; CopyConfig := True;
AddStatus('Checking for previous AMX Mod X installation...', clBlack); AddStatus('Checking for previous AMX Mod X installation...', clBlack);
@ -682,7 +682,7 @@ begin
// liblist.gam // liblist.gam
AddStatus('Editing liblist.gam...', clBlack); AddStatus('Editing liblist.gam...', clBlack);
eStr := TStringList.Create; eStr := TStringList.Create;
eStr.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam'); eStr.LoadFromFile(ExtractFilePath(Application.ExeName) + 'temp\liblist.gam');
if eStr.IndexOf('gamedll "addons\metamod\dlls\metamod.dll"') = -1 then begin if eStr.IndexOf('gamedll "addons\metamod\dlls\metamod.dll"') = -1 then begin
if Cancel then begin if Cancel then begin
AddStatus('', clBlack, False); AddStatus('', clBlack, False);
@ -700,8 +700,8 @@ begin
eStr.Add('gamedll_linux "addons/metamod/dlls/metamod_i386.so"') eStr.Add('gamedll_linux "addons/metamod/dlls/metamod_i386.so"')
else else
eStr.Add('gamedll_linux "addons/metamod/dlls/metamod_amd64.so"'); eStr.Add('gamedll_linux "addons/metamod/dlls/metamod_amd64.so"');
FileSetAttr(ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam', 0); FileSetAttr(ExtractFilePath(Application.ExeName) + 'temp\liblist.gam', 0);
eStr.SaveToFile(ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam'); eStr.SaveToFile(ExtractFilePath(Application.ExeName) + 'temp\liblist.gam');
end; end;
eStr.Free; eStr.Free;
AddDone; AddDone;
@ -767,8 +767,8 @@ begin
if not IsForbidden(FileList[i], OS) then begin if not IsForbidden(FileList[i], OS) then begin
AddStatus('Uploading file: ' + FileList[i], clBlack); AddStatus('Uploading file: ' + FileList[i], clBlack);
if FileExists(ExtractFilePath(ParamStr(0)) + 'temp\' + FileList[i]) then begin if FileExists(ExtractFilePath(Application.ExeName) + 'temp\' + FileList[i]) then begin
frmMain.ggeItem.MaxValue := FSize(ExtractFilePath(ParamStr(0)) + 'temp\' + FileList[i]); frmMain.ggeItem.MaxValue := FSize(ExtractFilePath(Application.ExeName) + 'temp\' + FileList[i]);
UploadAgain: UploadAgain:
try try
eGoBack := False; eGoBack := False;
@ -780,7 +780,7 @@ begin
AddStatus('Warning: CHMOD not supported.', clMaroon); AddStatus('Warning: CHMOD not supported.', clMaroon);
end; end;
UploadFile(ExtractFilePath(ParamStr(0)) + 'temp\' + FileList[i], ePath + FileList[i], CopyConfig); UploadFile(ExtractFilePath(Application.ExeName) + 'temp\' + FileList[i], ePath + FileList[i], CopyConfig);
try try
if FileList[i] = 'liblist.gam' then if FileList[i] = 'liblist.gam' then
@ -823,8 +823,8 @@ begin
end; end;
AddStatus('', clBlack, False); AddStatus('', clBlack, False);
AddStatus('Cleaning up installation...', clBlack, False); AddStatus('Cleaning up installation...', clBlack, False);
if (DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp')) then if (DirectoryExists(ExtractFilePath(Application.ExeName) + 'temp')) then
DelTree(ExtractFilePath(ParamStr(0)) + 'temp'); DelTree(ExtractFilePath(Application.ExeName) + 'temp');
AddDone; AddDone;
frmMain.ggeAll.Progress := frmMain.ggeAll.MaxValue; frmMain.ggeAll.Progress := frmMain.ggeAll.MaxValue;

View File

@ -252,12 +252,12 @@ begin
//optLinux64.Enabled := False; //optLinux64.Enabled := False;
cboGameAddon.Enabled := False; cboGameAddon.Enabled := False;
// preinstall... // preinstall...
MakeDir(ExtractFilePath(ParamStr(0)) + 'temp'); MakeDir(ExtractFilePath(Application.ExeName) + 'temp');
DownloadFile('liblist.gam', ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam'); DownloadFile('liblist.gam', ExtractFilePath(Application.ExeName) + 'temp\liblist.gam');
try try
IdFTP.ChangeDir(ePath + 'addons/metamod/'); IdFTP.ChangeDir(ePath + 'addons/metamod/');
ForceDirectories(ExtractFilePath(ParamStr(0)) + 'temp\addons\metamod\'); ForceDirectories(ExtractFilePath(Application.ExeName) + 'temp\addons\metamod\');
DownloadFile('plugins.ini', ExtractFilePath(ParamStr(0)) + 'temp\addons\metamod\plugins.ini'); DownloadFile('plugins.ini', ExtractFilePath(Application.ExeName) + 'temp\addons\metamod\plugins.ini');
except except
try try
IdFTP.ChangeDir(ePath); IdFTP.ChangeDir(ePath);
@ -293,7 +293,7 @@ begin
ggeAll.Progress := 0; ggeAll.Progress := 0;
ggeItem.Progress := 0; ggeItem.Progress := 0;
cmdNext.Hide; cmdNext.Hide;
InstallCustom(ExtractFilePath(ParamStr(0)) + 'temp\', ChosenMod, eOS); InstallCustom(ExtractFilePath(Application.ExeName) + 'temp\', ChosenMod, eOS);
if Cancel then if Cancel then
exit; exit;
AddStatus('', clBlack, False); AddStatus('', clBlack, False);
@ -783,11 +783,11 @@ procedure TfrmMain.FormCreate(Sender: TObject);
begin begin
if LowerCase(ParamStr(1)) = '-logftp' then begin if LowerCase(ParamStr(1)) = '-logftp' then begin
MessageBox(Handle, 'FTP installation will be logged to FTP.log!', PChar(Application.Title), MB_ICONINFORMATION); MessageBox(Handle, 'FTP installation will be logged to FTP.log!', PChar(Application.Title), MB_ICONINFORMATION);
IdLogFile.Filename := ExtractFilePath(ParamStr(0)) + 'FTP.log'; IdLogFile.Filename := ExtractFilePath(Application.ExeName) + 'FTP.log';
IdLogFile.Active := True; IdLogFile.Active := True;
end; end;
if not DirectoryExists(ExtractFilePath(ParamStr(0)) + 'files') then begin if not DirectoryExists(ExtractFilePath(Application.ExeName) + 'files') then begin
MessageBox(Handle, 'The files-folder couldn''t be found. Run the Pre-Installer of AMX Mod X and try again.', 'Error', MB_ICONERROR); MessageBox(Handle, 'The files-folder couldn''t be found. Run the Pre-Installer of AMX Mod X and try again.', 'Error', MB_ICONERROR);
Application.Terminate; Application.Terminate;
end end
@ -798,8 +798,8 @@ begin
end; end;
// delete files, then directories // delete files, then directories
if (DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp')) then if (DirectoryExists(ExtractFilePath(Application.ExeName) + 'temp')) then
DelTree(ExtractFilePath(ParamStr(0)) + 'temp'); DelTree(ExtractFilePath(Application.ExeName) + 'temp');
end; end;
procedure TfrmMain.cmdProxySettingsClick(Sender: TObject); procedure TfrmMain.cmdProxySettingsClick(Sender: TObject);
@ -912,8 +912,8 @@ begin
end; end;
end; end;
if (DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp')) then if (DirectoryExists(ExtractFilePath(Application.ExeName) + 'temp')) then
DelTree(ExtractFilePath(ParamStr(0)) + 'temp'); DelTree(ExtractFilePath(Application.ExeName) + 'temp');
end; end;
procedure TfrmMain.ExceptionHandler(Sender: TObject; E: Exception); procedure TfrmMain.ExceptionHandler(Sender: TObject; E: Exception);