From f79f1cdca76908fe1d57e3fbfe92e4ba54bad752 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 20 Sep 2023 19:30:45 +0300 Subject: [PATCH] Fix strange path in disk paths if path separator was not included. --- od-win32/win32gui.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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(" }")); -- 2.47.3