[FL-2565] Archive: switch to browser worker #1295
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "path.h"
|
||||
#include "m-string.h"
|
||||
#include <stddef.h>
|
||||
|
||||
void path_extract_filename_no_ext(const char* path, string_t filename) {
|
||||
string_set(filename, path);
|
||||
@@ -33,6 +35,15 @@ void path_extract_filename(string_t path, string_t name, bool trim_ext) {
|
||||
}
|
||||
}
|
||||
|
||||
void path_extract_extension(string_t path, char* ext, size_t ext_len_max) {
|
||||
size_t dot = string_search_rchar(path, '.');
|
||||
size_t filename_start = string_search_rchar(path, '/');
|
||||
|
||||
if((dot > 0) && (filename_start < dot)) {
|
||||
strlcpy(ext, &(string_get_cstr(path))[dot], ext_len_max);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void path_cleanup(string_t path) {
|
||||
string_strim(path);
|
||||
while(string_end_with_str_p(path, "/")) {
|
||||
|
@@ -23,6 +23,15 @@ void path_extract_filename_no_ext(const char* path, string_t filename);
|
||||
*/
|
||||
void path_extract_filename(string_t path, string_t filename, bool trim_ext);
|
||||
|
||||
/**
|
||||
* @brief Extract file extension from path.
|
||||
*
|
||||
* @param path path string
|
||||
* @param ext output extension string
|
||||
* @param ext_len_max maximum extension string length
|
||||
*/
|
||||
void path_extract_extension(string_t path, char* ext, size_t ext_len_max);
|
||||
|
||||
/**
|
||||
* @brief Extract last path component
|
||||
*
|
||||
|
Reference in New Issue
Block a user