]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Fix strange path in disk paths if path separator was not included.
authorToni Wilen <twilen@winuae.net>
Wed, 20 Sep 2023 16:30:45 +0000 (19:30 +0300)
committerToni Wilen <twilen@winuae.net>
Wed, 20 Sep 2023 16:30:45 +0000 (19:30 +0300)
od-win32/win32gui.cpp

index d6823bbd83c16b52e74d568781916037f45ae03a..58754fb39ca1d85b02d7e5d79a260e89d649d926 100644 (file)
@@ -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(" }"));