fixed yet another bug

This commit is contained in:
Christian Hammacher 2006-05-19 22:09:43 +00:00
parent 3d932c8a36
commit 444e2caa68
4 changed files with 15 additions and 10 deletions

Binary file not shown.

View File

@ -84,7 +84,7 @@ begin
if DirectoryExists(ePath) then begin if DirectoryExists(ePath) then begin
if FindFirst(ePath + '*.*', faAnyFile, eSearch) = 0 then begin if FindFirst(ePath + '*.*', faAnyFile, eSearch) = 0 then begin
repeat repeat
if (eSearch.Attr and faDirectory = faDirectory) and (eSearch.Name <> '.') and (eSearch.Name <> '..') and (LowerCase(eSearch.Name) <> 'sourcemods') then if (eSearch.Attr and faDirectory = faDirectory) and (eSearch.Name <> '.') and (eSearch.Name <> '..') then
Result.Add(eSearch.Name) Result.Add(eSearch.Name)
until FindNext(eSearch) <> 0; until FindNext(eSearch) <> 0;
end; end;

View File

@ -34,7 +34,7 @@ begin
Result := eDirectories; Result := eDirectories;
end end
else else
Result := nil; Result := TStringList.Create; // bad but prevents exception!
end; end;
function GetModPathName(eMod: String): String; function GetModPathName(eMod: String): String;

View File

@ -415,14 +415,16 @@ begin
for i := 0 to Count -1 do begin for i := 0 to Count -1 do begin
SteamPath := ePath + Strings[i] + '\dedicated server\'; SteamPath := ePath + Strings[i] + '\dedicated server\';
if DirectoryExists(SteamPath) then begin if DirectoryExists(SteamPath) then begin
CurNode := trvMods.Items.Add(nil, Strings[i]);
eStr := GetAllMods(SteamPath, False); eStr := GetAllMods(SteamPath, False);
for k := 0 to eStr.Count -1 do if eStr.Count <> 0 then begin
trvMods.Items.AddChild(CurNode, eStr[k]); CurNode := trvMods.Items.Add(nil, Strings[i]);
eStr.Free;
CurNode.Expand(False); for k := 0 to eStr.Count -1 do
trvMods.Items.AddChild(CurNode, eStr[k]);
eStr.Free;
CurNode.Expand(False);
end;
end; end;
end; end;
end; end;
@ -467,14 +469,14 @@ begin
for i := 0 to Count -1 do begin for i := 0 to Count -1 do begin
SteamPath := ePath + Strings[i] + '\'; SteamPath := ePath + Strings[i] + '\';
if DirectoryExists(SteamPath) then begin if DirectoryExists(SteamPath) then begin
eStr := GetAllMods(SteamPath, False);
CurNode := trvMods.Items.Add(nil, Strings[i]); CurNode := trvMods.Items.Add(nil, Strings[i]);
eStr := GetAllMods(SteamPath, False);
for k := 0 to eStr.Count -1 do for k := 0 to eStr.Count -1 do
trvMods.Items.AddChild(CurNode, eStr[k]); trvMods.Items.AddChild(CurNode, eStr[k]);
eStr.Free; eStr.Free;
CurNode.Expand(False); CurNode.Expand(False);
if DirectoryExists(SteamPath + 'half-life') then begin if DirectoryExists(SteamPath + 'half-life') then begin
eStr := GetAllMods(SteamPath + 'half-life', False); eStr := GetAllMods(SteamPath + 'half-life', False);
@ -482,6 +484,9 @@ begin
trvMods.Items.AddChild(CurNode, eStr[k]); trvMods.Items.AddChild(CurNode, eStr[k]);
eStr.Free; eStr.Free;
end; end;
if CurNode.Count = 0 then
CurNode.Free;
end; end;
end; end;
end; end;