(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;
begin
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;
Free;
end;
AddDone('found ' + IntToStr(DirList.Count) + ' directories..');
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;
Free;
end;
@ -343,9 +343,9 @@ begin
end;
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
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 }
if not FileExists(ePath + 'liblist.gam') then begin
@ -454,44 +454,44 @@ begin
if not IsForbidden(FileList[i], OS) then begin
if Pos('base', FileList[i]) = 1 then begin
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;
case eMod of
modCS: begin
if Pos('cstrike', FileList[i]) = 1 then begin
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;
modDoD: begin
if Pos('dod', FileList[i]) = 1 then begin
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;
modTFC: begin
if Pos('tfc', FileList[i]) = 1 then begin
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;
modNS: begin
if Pos('ns', FileList[i]) = 1 then begin
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;
modTS: begin
if Pos('ts', FileList[i]) = 1 then begin
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;
modESF: begin
if Pos('esf', FileList[i]) = 1 then begin
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;
@ -643,13 +643,13 @@ begin
frmMain.cmdNext.Hide;
Screen.Cursor := crHourGlass;
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;
Free;
end;
AddDone('found ' + IntToStr(DirList.Count) + ' directories..');
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;
Free;
end;
@ -660,9 +660,9 @@ begin
frmMain.ggeItem.MaxValue := DirList.Count;
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
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;
AddStatus('Checking for previous AMX Mod X installation...', clBlack);
@ -682,7 +682,7 @@ begin
// liblist.gam
AddStatus('Editing liblist.gam...', clBlack);
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 Cancel then begin
AddStatus('', clBlack, False);
@ -700,8 +700,8 @@ begin
eStr.Add('gamedll_linux "addons/metamod/dlls/metamod_i386.so"')
else
eStr.Add('gamedll_linux "addons/metamod/dlls/metamod_amd64.so"');
FileSetAttr(ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam', 0);
eStr.SaveToFile(ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam');
FileSetAttr(ExtractFilePath(Application.ExeName) + 'temp\liblist.gam', 0);
eStr.SaveToFile(ExtractFilePath(Application.ExeName) + 'temp\liblist.gam');
end;
eStr.Free;
AddDone;
@ -767,8 +767,8 @@ begin
if not IsForbidden(FileList[i], OS) then begin
AddStatus('Uploading file: ' + FileList[i], clBlack);
if FileExists(ExtractFilePath(ParamStr(0)) + 'temp\' + FileList[i]) then begin
frmMain.ggeItem.MaxValue := FSize(ExtractFilePath(ParamStr(0)) + 'temp\' + FileList[i]);
if FileExists(ExtractFilePath(Application.ExeName) + 'temp\' + FileList[i]) then begin
frmMain.ggeItem.MaxValue := FSize(ExtractFilePath(Application.ExeName) + 'temp\' + FileList[i]);
UploadAgain:
try
eGoBack := False;
@ -780,7 +780,7 @@ begin
AddStatus('Warning: CHMOD not supported.', clMaroon);
end;
UploadFile(ExtractFilePath(ParamStr(0)) + 'temp\' + FileList[i], ePath + FileList[i], CopyConfig);
UploadFile(ExtractFilePath(Application.ExeName) + 'temp\' + FileList[i], ePath + FileList[i], CopyConfig);
try
if FileList[i] = 'liblist.gam' then
@ -823,8 +823,8 @@ begin
end;
AddStatus('', clBlack, False);
AddStatus('Cleaning up installation...', clBlack, False);
if (DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp')) then
DelTree(ExtractFilePath(ParamStr(0)) + 'temp');
if (DirectoryExists(ExtractFilePath(Application.ExeName) + 'temp')) then
DelTree(ExtractFilePath(Application.ExeName) + 'temp');
AddDone;
frmMain.ggeAll.Progress := frmMain.ggeAll.MaxValue;

View File

@ -252,12 +252,12 @@ begin
//optLinux64.Enabled := False;
cboGameAddon.Enabled := False;
// preinstall...
MakeDir(ExtractFilePath(ParamStr(0)) + 'temp');
DownloadFile('liblist.gam', ExtractFilePath(ParamStr(0)) + 'temp\liblist.gam');
MakeDir(ExtractFilePath(Application.ExeName) + 'temp');
DownloadFile('liblist.gam', ExtractFilePath(Application.ExeName) + 'temp\liblist.gam');
try
IdFTP.ChangeDir(ePath + 'addons/metamod/');
ForceDirectories(ExtractFilePath(ParamStr(0)) + 'temp\addons\metamod\');
DownloadFile('plugins.ini', ExtractFilePath(ParamStr(0)) + 'temp\addons\metamod\plugins.ini');
ForceDirectories(ExtractFilePath(Application.ExeName) + 'temp\addons\metamod\');
DownloadFile('plugins.ini', ExtractFilePath(Application.ExeName) + 'temp\addons\metamod\plugins.ini');
except
try
IdFTP.ChangeDir(ePath);
@ -293,7 +293,7 @@ begin
ggeAll.Progress := 0;
ggeItem.Progress := 0;
cmdNext.Hide;
InstallCustom(ExtractFilePath(ParamStr(0)) + 'temp\', ChosenMod, eOS);
InstallCustom(ExtractFilePath(Application.ExeName) + 'temp\', ChosenMod, eOS);
if Cancel then
exit;
AddStatus('', clBlack, False);
@ -783,11 +783,11 @@ procedure TfrmMain.FormCreate(Sender: TObject);
begin
if LowerCase(ParamStr(1)) = '-logftp' then begin
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;
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);
Application.Terminate;
end
@ -798,8 +798,8 @@ begin
end;
// delete files, then directories
if (DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp')) then
DelTree(ExtractFilePath(ParamStr(0)) + 'temp');
if (DirectoryExists(ExtractFilePath(Application.ExeName) + 'temp')) then
DelTree(ExtractFilePath(Application.ExeName) + 'temp');
end;
procedure TfrmMain.cmdProxySettingsClick(Sender: TObject);
@ -912,8 +912,8 @@ begin
end;
end;
if (DirectoryExists(ExtractFilePath(ParamStr(0)) + 'temp')) then
DelTree(ExtractFilePath(ParamStr(0)) + 'temp');
if (DirectoryExists(ExtractFilePath(Application.ExeName) + 'temp')) then
DelTree(ExtractFilePath(Application.ExeName) + 'temp');
end;
procedure TfrmMain.ExceptionHandler(Sender: TObject; E: Exception);