summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fbef4d7)
raw | patch | inline | side by side (parent: fbef4d7)
author | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Mon, 15 May 2023 12:21:33 +0000 (22:21 +1000) | ||
committer | Dmitry D. Chernov <blackdoomer@yandex.ru> | |
Mon, 15 May 2023 12:21:33 +0000 (22:21 +1000) |
This fixes a bug with broken folder navigation in file lists.
src/engine/e_res.pas | patch | blob | history | |
src/game/g_gui.pas | patch | blob | history |
diff --git a/src/engine/e_res.pas b/src/engine/e_res.pas
index e48cc32ed5746264150eb419cbf14ee36db99135..69adb6e6eb5faa6b5e4fd98c0d919b270cb50501 100644 (file)
--- a/src/engine/e_res.pas
+++ b/src/engine/e_res.pas
function e_UpperDir (path: AnsiString): AnsiString;
var i: Integer;
begin
- i := High(path);
+ i := High(path); // consider possible cases: '\a\', '\a', '\abc\'
while (i >= 1) and (path[i] <> '/') and (path[i] <> '\') do Dec(i);
- result := Copy(path, 1, i)
+ result := Copy(path, 1, i-1) // exclude the trailing separator
end;
function HasRelativeDirs (name: AnsiString): Boolean;
diff --git a/src/game/g_gui.pas b/src/game/g_gui.pas
index b8b19999fb4728c9edcbe2b880d1373e98d455aa..2200703437db6be9fc693d2bdfbd83dc76a55b31 100644 (file)
--- a/src/game/g_gui.pas
+++ b/src/game/g_gui.pas
begin
if FItems[FIndex] = #29 + '..' then
begin
- e_LogWritefln('TGUIFileListBox: Upper dir "%s" -> "%s"', [FSubPath, e_UpperDir(FSubPath)]);
+ //e_LogWritefln('TGUIFileListBox: Upper dir "%s" -> "%s"', [FSubPath, e_UpperDir(FSubPath)]);
FSubPath := e_UpperDir(FSubPath)
end
else
begin
s := Copy(AnsiString(FItems[FIndex]), 2);
- e_LogWritefln('TGUIFileListBox: Enter dir "%s" -> "%s"', [FSubPath, e_CatPath(FSubPath, s)]);
+ //e_LogWritefln('TGUIFileListBox: Enter dir "%s" -> "%s"', [FSubPath, e_CatPath(FSubPath, s)]);
FSubPath := e_CatPath(FSubPath, s);
end;
ScanDirs;