Skip to content
Snippets Groups Projects
Commit a0d70f42 authored by dmitriy.gerasimov's avatar dmitriy.gerasimov
Browse files

Merge branch 'feature-4142' into 'master'

Feature 4142

See merge request !264
parents f3e9ffdb 979e1634
No related branches found
No related tags found
1 merge request!264Feature 4142
Pipeline #6664 passed with stage
in 15 seconds
...@@ -100,6 +100,7 @@ int dap_mkdir_with_parents(const char *a_dir_path); ...@@ -100,6 +100,7 @@ int dap_mkdir_with_parents(const char *a_dir_path);
char* dap_path_get_basename(const char *a_file_name); char* dap_path_get_basename(const char *a_file_name);
bool dap_path_is_absolute(const char *a_file_name); bool dap_path_is_absolute(const char *a_file_name);
char* dap_path_get_dirname(const char *a_file_name); char* dap_path_get_dirname(const char *a_file_name);
const char* dap_path_get_ext(const char *a_filename);
/** /**
* Get list of subdirectories * Get list of subdirectories
......
...@@ -409,6 +409,34 @@ dap_list_name_directories_t *dap_get_subs(const char *a_path_dir){ ...@@ -409,6 +409,34 @@ dap_list_name_directories_t *dap_get_subs(const char *a_path_dir){
return list; return list;
} }
/**
* dap_path_get_ext:
* @a_file_name: the name of the file
*
* Gets the extension components of a file name.
*
* Returns: the extension components of the file
*/
const char* dap_path_get_ext(const char *a_filename)
{
size_t l_len = dap_strlen(a_filename);
const char *l_p = a_filename + l_len - 1;
if(l_len < 2)
return NULL ;
while(l_p > a_filename)
{
if(*l_p == '.') {
return ++l_p;
}
l_p--;
}
return NULL ;
}
static bool get_contents_stdio(const char *filename, FILE *f, char **contents, size_t *length) static bool get_contents_stdio(const char *filename, FILE *f, char **contents, size_t *length)
{ {
char buf[4096]; char buf[4096];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment