add Find_last_separator_unicode() function

This commit is contained in:
Thomas Bernard 2018-12-18 17:50:57 +01:00
parent c99fa40e6a
commit 322d95add8
2 changed files with 20 additions and 1 deletions

View File

@ -258,7 +258,7 @@ char * Find_last_separator(const char * str)
const char * position = NULL; const char * position = NULL;
for (; *str != '\0'; str++) for (; *str != '\0'; str++)
if (*str == PATH_SEPARATOR[0] if (*str == PATH_SEPARATOR[0]
#ifdef __WIN32__ #if defined(__WIN32__) || defined(WIN32)
|| *str == '/' || *str == '/'
#elif __AROS__ #elif __AROS__
|| *str == ':' || *str == ':'
@ -267,6 +267,22 @@ char * Find_last_separator(const char * str)
position = str; position = str;
return (char *)position; return (char *)position;
} }
word * Find_last_separator_unicode(const word * str)
{
const word * position = NULL;
for (; *str != 0; str++)
if (*str == (byte)PATH_SEPARATOR[0]
#if defined(__WIN32__) || defined(WIN32)
|| *str == '/'
#elif __AROS__
|| *str == ':'
#endif
)
position = str;
return (word *)position;
}
// Récupère la partie "nom de file seul" d'un chemin // Récupère la partie "nom de file seul" d'un chemin
void Extract_filename(char *dest, const char *source) void Extract_filename(char *dest, const char *source)
{ {

View File

@ -98,6 +98,9 @@ void Extract_path(char *dest, const char *source);
/// Finds the rightmost path separator in a full filename. Used to separate directory from file. /// Finds the rightmost path separator in a full filename. Used to separate directory from file.
char * Find_last_separator(const char * str); char * Find_last_separator(const char * str);
/// Finds the rightmost path separator in a full filename in unicode. Used to separate directory from file.
word * Find_last_separator_unicode(const word * str);
/// default path separator character /// default path separator character
#if defined(WIN32) || defined(__MINT__) #if defined(WIN32) || defined(__MINT__)
#define PATH_SEPARATOR "\\" #define PATH_SEPARATOR "\\"