unleashed-firmware/lib/toolbox/path.h
Nikolay Minaylov 79920a3522
[FL-2491] File browser GUI module (#1237)
* File browser module and test app
* nfc: Add support for saved files in subdirectories
* nfc: Use helper function to get shadow path when loading data
* File browser dialog integration pt.1
* File browser dialog integration pt.2
* Gui,Dialogs: drop file select
* Correct use of dynamic string_t(string_ptr)

Co-authored-by: Yukai Li <yukaili.geek@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2022-05-27 14:19:21 +03:00

62 lines
1.5 KiB
C

#pragma once
#include <m-string.h>
#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.
*/
void path_extract_filename_no_ext(const char* path, string_t filename);
/**
* @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
*/
void path_extract_filename(string_t path, string_t filename, bool trim_ext);
/**
* @brief Extract last path component
*
* @param path path string
* @param filename output string. Must be initialized before.
*/
void path_extract_basename(const char* path, string_t basename);
/**
* @brief Extract path, except for last component
*
* @param path path string
* @param filename output string. Must be initialized before.
*/
void path_extract_dirname(const char* path, string_t dirname);
/**
* @brief Appends new component to path, adding path delimiter
*
* @param path path string
* @param suffix path part to apply
*/
void path_append(string_t path, const char* suffix);
/**
* @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
*/
void path_concat(const char* path, const char* suffix, string_t out_path);
#ifdef __cplusplus
}
#endif