src/fios.cpp
changeset 7259 51195486289c
parent 7251 19f5ab36616e
child 7425 350b9265b7a2
equal deleted inserted replaced
7258:8a92d98ecb19 7259:51195486289c
   112 	case FIOS_TYPE_DRIVE: sprintf(path, "%c:" PATHSEP, item->title[0]); break;
   112 	case FIOS_TYPE_DRIVE: sprintf(path, "%c:" PATHSEP, item->title[0]); break;
   113 #endif
   113 #endif
   114 
   114 
   115 	case FIOS_TYPE_PARENT:
   115 	case FIOS_TYPE_PARENT:
   116 		/* Check for possible NULL ptr (not required for UNIXes, but AmigaOS-alikes) */
   116 		/* Check for possible NULL ptr (not required for UNIXes, but AmigaOS-alikes) */
   117 		if ((s = strrchr(path, PATHSEPCHAR)) != path) {
   117 		s = strrchr(path, PATHSEPCHAR);
       
   118 		if (s != NULL && s != path) {
   118 			s[0] = '\0'; // Remove last path separator character, so we can go up one level.
   119 			s[0] = '\0'; // Remove last path separator character, so we can go up one level.
   119 			s = strrchr(path, PATHSEPCHAR);
       
   120 			if (s != NULL) s[1] = '\0'; // go up a directory
       
   121 		}
   120 		}
       
   121 		s = strrchr(path, PATHSEPCHAR);
       
   122 		if (s != NULL) s[1] = '\0'; // go up a directory
   122 #if defined(__MORPHOS__) || defined(__AMIGAOS__)
   123 #if defined(__MORPHOS__) || defined(__AMIGAOS__)
   123 		/* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
   124 		/* On MorphOS or AmigaOS paths look like: "Volume:directory/subdirectory" */
   124 		else if ((s = strrchr(path, ':')) != NULL) s[1] = '\0';
   125 		else if ((s = strrchr(path, ':')) != NULL) s[1] = '\0';
   125 #endif
   126 #endif
   126 		break;
   127 		break;