New upstream version 0.15.4+dfsg1

This commit is contained in:
Sebastian Ramacher 2016-08-28 14:07:43 +02:00
parent 55d5047af0
commit 67704ac59c
359 changed files with 8423 additions and 1050 deletions

View file

@ -633,3 +633,26 @@ int os_mkdirs(const char *dir)
dstr_free(&dir_str);
return ret;
}
const char *os_get_path_extension(const char *path)
{
struct dstr temp;
size_t pos = 0;
char *period;
char *slash;
dstr_init_copy(&temp, path);
dstr_replace(&temp, "\\", "/");
slash = strrchr(temp.array, '/');
period = strrchr(temp.array, '.');
if (period)
pos = (size_t)(period - temp.array);
dstr_free(&temp);
if (!period || slash > period)
return NULL;
return path + pos;
}