]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
x:\, x:\. and x:\.. are identical paths.
authorToni Wilen <twilen@winuae.net>
Sat, 5 Jan 2019 13:54:08 +0000 (15:54 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 5 Jan 2019 13:54:08 +0000 (15:54 +0200)
filesys.cpp
include/uae.h
od-win32/win32.cpp

index e42433feece7057b49b7f544ce95f6466738c0bd..28ddc167b87ff63ba26ac7177f7d889e674cd501 100644 (file)
@@ -705,7 +705,7 @@ static int set_filesys_unit_1 (int nr, struct uaedev_config_info *ci, bool custo
        for (i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
                if (nr == i || !mountinfo.ui[i].open || mountinfo.ui[i].rootdir == NULL || is_hardfile (i) == FILESYS_CD)
                        continue;
-               if (_tcslen (c.rootdir) > 0 && !_tcsicmp (mountinfo.ui[i].rootdir, c.rootdir)) {
+               if (_tcslen(c.rootdir) > 0 && samepath(mountinfo.ui[i].rootdir, c.rootdir)) {
                        error_log (_T("directory/hardfile '%s' already added."), c.rootdir);
                        return -1;
                }
index 9fa23022d6521ffe791facc2003d069335dad7c8..cfdb8ff1d18032ba92a7204f718db0a2d685239e 100644 (file)
@@ -45,6 +45,7 @@ extern void fullpath(TCHAR *path, int size);
 extern void fullpath(TCHAR *path, int size, bool userelative);
 extern void getpathpart (TCHAR *outpath, int size, const TCHAR *inpath);
 extern void getfilepart (TCHAR *out, int size, const TCHAR *path);
+extern bool samepath(const TCHAR *p1, const TCHAR *p2);
 extern bool target_isrelativemode(void);
 extern uae_u32 getlocaltime (void);
 extern bool isguiactive(void);
index 718e4d0fd69214639af2e0b8bab6e801888082f5..72dd68b3568445b1373116a2b46a797527e582ea 100644 (file)
@@ -3554,6 +3554,13 @@ void fixtrailing (TCHAR *p)
                return;
        _tcscat(p, _T("\\"));
 }
+static void fixdriveletter(TCHAR *path)
+{
+       if (_istalpha(path[0]) && path[1] == ':' && path[2] == '\\' && path[3] == '.' && path[4] == 0)
+               path[3] = 0;
+       if (_istalpha(path[0]) && path[1] == ':' && path[2] == '\\' && path[3] == '.' && path[4] == '.' && path[5] == 0)
+               path[3] = 0;
+}
 // convert path to absolute or relative
 void fullpath(TCHAR *path, int size, bool userelative)
 {
@@ -3610,10 +3617,24 @@ done:;
                DWORD err = GetFullPathName (tmp, size, path, NULL);
        }
 }
+
 void fullpath(TCHAR *path, int size)
 {
        fullpath(path, size, relativepaths);
 }
+bool samepath(const TCHAR *p1, const TCHAR *p2)
+{
+       if (!_tcsicmp(p1, p2))
+               return true;
+       TCHAR path1[MAX_DPATH], path2[MAX_DPATH];
+       _tcscpy(path1, p1);
+       _tcscpy(path2, p2);
+       fixdriveletter(path1);
+       fixdriveletter(path2);
+       if (!_tcsicmp(path1, path2))
+               return true;
+       return false;
+}
 
 bool target_isrelativemode(void)
 {