diff --git a/src/buttons.c b/src/buttons.c index 8a80fe0c..777ed189 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -1197,7 +1197,7 @@ void Add_font_or_skin(const char *name) int namelength; // Cut the long name to keep only filename (no directory) - fname = Find_last_slash(name); + fname = Find_last_separator(name); if (fname) fname++; else diff --git a/src/engine.c b/src/engine.c index a2d0fa12..4e2b1e37 100644 --- a/src/engine.c +++ b/src/engine.c @@ -685,7 +685,7 @@ void Main_handler(void) Upload_infos_page_main(Main_backups->Pages); - flimit = Find_last_slash(Drop_file_name); + flimit = Find_last_separator(Drop_file_name); *(flimit++) = '\0'; Hide_cursor(); diff --git a/src/factory.c b/src/factory.c index a100167c..523686f1 100644 --- a/src/factory.c +++ b/src/factory.c @@ -33,7 +33,7 @@ #include "filesel.h" // Get_item_by_index #include "global.h" #include "graph.h" -#include "io.h" // find_last_slash +#include "io.h" // find_last_separator #include "misc.h" #include "pages.h" // Backup() #include "readline.h" @@ -1522,7 +1522,7 @@ void Add_script(const char *name, byte is_file, byte is_directory, byte is_hidde const char * file_name; int len; - file_name=Find_last_slash(name)+1; + file_name=Find_last_separator(name)+1; if (is_file) { diff --git a/src/filesel.c b/src/filesel.c index a9a9eeb1..113b9648 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -1742,7 +1742,7 @@ byte Button_Load_or_Save(byte load, T_IO_Context *context) Config.Bookmark_directory[clicked_button-10]=malloc(temp+1); strcpy(Config.Bookmark_directory[clicked_button-10],Main_current_directory); - directory_name=Find_last_slash(Main_current_directory); + directory_name=Find_last_separator(Main_current_directory); if (directory_name && directory_name[1]!='\0') directory_name++; else diff --git a/src/io.c b/src/io.c index c189f01a..9cbdcd37 100644 --- a/src/io.c +++ b/src/io.c @@ -165,7 +165,7 @@ int Write_dword_be(FILE *file, dword dw) // Attention, sous Windows, il faut s'attendre aux deux car // par exemple un programme lancé sous GDB aura comme argv[0]: // d:\Data\C\GFX2\grafx2/grafx2.exe -char * Find_last_slash(const char * str) +char * Find_last_separator(const char * str) { const char * position = NULL; for (; *str != '\0'; str++) @@ -182,7 +182,7 @@ char * Find_last_slash(const char * str) // Récupère la partie "nom de file seul" d'un chemin void Extract_filename(char *dest, const char *source) { - const char * position = Find_last_slash(source); + const char * position = Find_last_separator(source); if (position) strcpy(dest,position+1); @@ -195,7 +195,7 @@ void Extract_path(char *dest, const char *source) char * position=NULL; Realpath(source,dest); - position = Find_last_slash(dest); + position = Find_last_separator(dest); if (position) *(position+1) = '\0'; else @@ -217,7 +217,7 @@ void Append_path(char *path, const char *filename, char *reverse_path) { // Going up one directory long len; - char * slash_pos; + char * separator_pos; // Remove trailing slash len=strlen(path); @@ -228,12 +228,18 @@ void Append_path(char *path, const char *filename, char *reverse_path) )) path[len-1]='\0'; - slash_pos=Find_last_slash(path); - if (slash_pos) + separator_pos=Find_last_separator(path); + if (separator_pos) { if (reverse_path) - strcpy(reverse_path, slash_pos+1); - *slash_pos='\0'; + strcpy(reverse_path, separator_pos+1); + #if 0 + // Don't strip away the colon + if (*separator_pos == ':') *(separator_pos+1)='\0'; + else *separator_pos='\0'; + #else + *separator_pos='\0'; + #endif } else { @@ -258,6 +264,8 @@ void Append_path(char *path, const char *filename, char *reverse_path) if (len && (strcmp(path+len-1,PATH_SEPARATOR) #ifdef __WIN32__ && path[len-1]!='/' + #elif __AROS__ + && path[len-1]!=':' // To avoid paths like volume:/dir #endif )) { diff --git a/src/io.h b/src/io.h index 042ef337..724dfda2 100644 --- a/src/io.h +++ b/src/io.h @@ -68,7 +68,7 @@ void Extract_filename(char *dest, const char *source); void Extract_path(char *dest, const char *source); /// Finds the rightmost path separator in a full filename. Used to separate directory from file. -char * Find_last_slash(const char * str); +char * Find_last_separator(const char * str); #if defined(__WIN32__) #define PATH_SEPARATOR "\\" diff --git a/src/text.c b/src/text.c index 00644526..20564cba 100644 --- a/src/text.c +++ b/src/text.c @@ -168,7 +168,7 @@ void Add_font(const char *name) strcpy(font->Label, " "); if (font->Is_truetype) font->Label[17]=font->Label[18]='T'; // Logo TT - font_name=Find_last_slash(font->Name); + font_name=Find_last_separator(font->Name); if (font_name==NULL) font_name=font->Name; else