From b17a89c53d13c95375be9e5f37d40585dd13a1fa Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 30 May 2007 18:24:54 +0000 Subject: (svn r9990) -Fix: MorphOS and AmigaOS do not like "//" in filenames as that means the same as "/../" in means in Unix. --- src/fios.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/fios.cpp') diff --git a/src/fios.cpp b/src/fios.cpp index 73e2b3ad5..3d475676e 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -114,9 +114,10 @@ char *FiosBrowseTo(const FiosItem *item) case FIOS_TYPE_PARENT: /* Check for possible NULL ptr (not required for UNIXes, but AmigaOS-alikes) */ - if ((s = strrchr(path, PATHSEPCHAR)) != NULL) { - s[1] = '\0'; // go up a directory - if (!FiosIsRoot(path)) s[0] = '\0'; + if ((s = strrchr(path, PATHSEPCHAR)) != path) { + s[0] = '\0'; // Remove last path separator character, so we can go up one level. + s = strrchr(path, PATHSEPCHAR); + if (s != NULL) s[1] = '\0'; // go up a directory } #if defined(__MORPHOS__) || defined(__AMIGAOS__) /* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */ @@ -125,14 +126,12 @@ char *FiosBrowseTo(const FiosItem *item) break; case FIOS_TYPE_DIR: - if (!FiosIsRoot(path)) strcat(path, PATHSEP); strcat(path, item->name); + strcat(path, PATHSEP); break; case FIOS_TYPE_DIRECT: - sprintf(path, "%s" PATHSEP, item->name); - s = strrchr(path, PATHSEPCHAR); - if (s != NULL && s[1] == '\0') s[0] = '\0'; // strip trailing slash + sprintf(path, "%s", item->name); break; case FIOS_TYPE_FILE: @@ -150,7 +149,7 @@ char *FiosBrowseTo(const FiosItem *item) snprintf(str_buffr, lengthof(str_buffr), "%s:%s", path, item->name); } else // XXX - only next line! #endif - snprintf(str_buffr, lengthof(str_buffr), "%s" PATHSEP "%s", path, item->name); + snprintf(str_buffr, lengthof(str_buffr), "%s%s", path, item->name); return str_buffr; } -- cgit v1.2.3-70-g09d2