mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2025-08-16 09:48:00 +02:00
Fixes, improvements
This commit is contained in:
16
utils.c
16
utils.c
@ -130,3 +130,19 @@ int mkpath(char* file_path, mode_t mode)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char *get_ext(const char *path)
|
||||
{
|
||||
const char *base;
|
||||
|
||||
if ((base = strrchr(path, '/')))
|
||||
base += sizeof(*base);
|
||||
else
|
||||
base = path;
|
||||
|
||||
const char *dot = strchr(base, '.');
|
||||
if (!dot || dot == base)
|
||||
return NULL;
|
||||
|
||||
return &dot[1];
|
||||
}
|
||||
|
Reference in New Issue
Block a user