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;
}
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);
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)
{
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)
{