2021-06-30 12:02:46 +00:00
|
|
|
#pragma once
|
2022-10-05 15:15:23 +00:00
|
|
|
#include <furi.h>
|
2021-06-30 12:02:46 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Extract filename without extension from path.
|
|
|
|
*
|
|
|
|
* @param path path string
|
|
|
|
* @param filename output filename string. Must be initialized before.
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_extract_filename_no_ext(const char* path, FuriString* filename);
|
2021-06-30 12:02:46 +00:00
|
|
|
|
2022-05-27 11:19:21 +00:00
|
|
|
/**
|
|
|
|
* @brief Extract filename string from path.
|
|
|
|
*
|
|
|
|
* @param path path string
|
|
|
|
* @param filename output filename string. Must be initialized before.
|
|
|
|
* @param trim_ext true - get filename without extension
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_extract_filename(FuriString* path, FuriString* filename, bool trim_ext);
|
2022-05-27 11:19:21 +00:00
|
|
|
|
2022-06-09 07:09:52 +00:00
|
|
|
/**
|
|
|
|
* @brief Extract file extension from path.
|
|
|
|
*
|
|
|
|
* @param path path string
|
|
|
|
* @param ext output extension string
|
|
|
|
* @param ext_len_max maximum extension string length
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_extract_extension(FuriString* path, char* ext, size_t ext_len_max);
|
2022-06-09 07:09:52 +00:00
|
|
|
|
2022-04-13 20:50:25 +00:00
|
|
|
/**
|
|
|
|
* @brief Extract last path component
|
|
|
|
*
|
|
|
|
* @param path path string
|
|
|
|
* @param filename output string. Must be initialized before.
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_extract_basename(const char* path, FuriString* basename);
|
2022-04-13 20:50:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Extract path, except for last component
|
|
|
|
*
|
|
|
|
* @param path path string
|
|
|
|
* @param filename output string. Must be initialized before.
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_extract_dirname(const char* path, FuriString* dirname);
|
2022-04-13 20:50:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Appends new component to path, adding path delimiter
|
|
|
|
*
|
|
|
|
* @param path path string
|
|
|
|
* @param suffix path part to apply
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_append(FuriString* path, const char* suffix);
|
2022-04-13 20:50:25 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Appends new component to path, adding path delimiter
|
|
|
|
*
|
|
|
|
* @param path first path part
|
|
|
|
* @param suffix second path part
|
|
|
|
* @param out_path output string to combine parts into. Must be initialized
|
|
|
|
*/
|
2022-10-05 15:15:23 +00:00
|
|
|
void path_concat(const char* path, const char* suffix, FuriString* out_path);
|
2022-04-13 20:50:25 +00:00
|
|
|
|
2022-06-26 12:00:03 +00:00
|
|
|
/**
|
|
|
|
* @brief Check that path contains only ascii characters
|
|
|
|
*
|
|
|
|
* @param path
|
|
|
|
* @return true
|
|
|
|
* @return false
|
|
|
|
*/
|
|
|
|
bool path_contains_only_ascii(const char* path);
|
|
|
|
|
2021-06-30 12:02:46 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2022-04-13 20:50:25 +00:00
|
|
|
#endif
|