From: Toni Wilen Date: Wed, 20 Sep 2023 16:30:45 +0000 (+0300) Subject: Fix strange path in disk paths if path separator was not included. X-Git-Tag: 5.1.0~104 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=f79f1cdca76908fe1d57e3fbfe92e4ba54bad752;p=francis%2Fwinuae.git Fix strange path in disk paths if path separator was not included. --- diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index d6823bbd..58754fb3 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -16435,6 +16435,7 @@ static void addhistorymenu(HWND hDlg, const TCHAR *text, int f_text, int type, b break; i++; if (manglepath) { + bool path = false; TCHAR tmppath[MAX_DPATH], *p, *p2; _tcscpy (tmppath, s); p = tmppath + _tcslen (tmppath) - 1; @@ -16446,13 +16447,19 @@ static void addhistorymenu(HWND hDlg, const TCHAR *text, int f_text, int type, b } } while (p > tmppath) { - if (*p == '\\' || *p == '/') + if (*p == '\\' || *p == '/') { + path = true; break; + } p--; } - _tcscpy (tmpname, p + 1); + if (path) { + _tcscpy (tmpname, p + 1); + } else { + _tcscpy(tmpname, p); + } *++p = 0; - if (tmppath[0]) { + if (tmppath[0] && path) { _tcscat (tmpname, _T(" { ")); _tcscat (tmpname, tmppath); _tcscat (tmpname, _T(" }"));