mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-30 02:18:11 -07:00
Who tf made extensions have limited length???
This commit is contained in:
@@ -34,6 +34,18 @@ void path_extract_filename(FuriString* path, FuriString* name, bool trim_ext) {
|
||||
}
|
||||
}
|
||||
|
||||
void path_extract_ext_str(FuriString* path, FuriString* ext) {
|
||||
size_t dot = furi_string_search_rchar(path, '.');
|
||||
size_t filename_start = furi_string_search_rchar(path, '/');
|
||||
|
||||
if(dot != FURI_STRING_FAILURE && filename_start != FURI_STRING_FAILURE &&
|
||||
filename_start < dot) {
|
||||
furi_string_set_n(ext, path, dot, furi_string_size(path) - dot);
|
||||
} else {
|
||||
furi_string_reset(ext);
|
||||
}
|
||||
}
|
||||
|
||||
void path_extract_extension(FuriString* path, char* ext, size_t ext_len_max) {
|
||||
size_t dot = furi_string_search_rchar(path, '.');
|
||||
size_t filename_start = furi_string_search_rchar(path, '/');
|
||||
|
||||
@@ -22,6 +22,14 @@ void path_extract_filename_no_ext(const char* path, FuriString* filename);
|
||||
*/
|
||||
void path_extract_filename(FuriString* path, FuriString* filename, bool trim_ext);
|
||||
|
||||
/**
|
||||
* @brief Extract file extension string from path.
|
||||
*
|
||||
* @param path path string
|
||||
* @param ext output extension furi string
|
||||
*/
|
||||
void path_extract_ext_str(FuriString* path, FuriString* ext);
|
||||
|
||||
/**
|
||||
* @brief Extract file extension from path.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user