Folders management.
More...
|
sb_t_err | sb_folder_load (sb_t_folder **const f, const char *const path, const char *const ext, int sort, int verbosity) |
| Creates the list of the name of the files in a specified folder. More...
|
|
sb_t_err | sb_folder_destroy (sb_t_folder **folder) |
| Frees all the resources of the sb_t_folder structure. More...
|
|
sb_t_err | sb_folder_erase (sb_t_folder *folder, int index) |
| Removes the file with the specified index from the list. More...
|
|
sb_t_err | sb_folder_create (const char *const path) |
| Creates the folder with the specified path. More...
|
|
sb_t_err | sb_folder_remove (const char *const path) |
| Deletes a folder and all the files and subfolder contained. More...
|
|
sb_t_err | sb_folder_rename (const char *const oldpath, const char *const newpath) |
| Renames a folder. More...
|
|
sb_t_err | sb_folder_exist (const char *const path, int *const exist) |
| Checks if the folder with the specified path exists. More...
|
|
sb_t_err | sb_file_extract_name (const char *const full, int with_ext, char *const name, int name_size) |
| Extracts the file name from the full file path. More...
|
|
sb_t_err | sb_file_extract_folder (const char *const full, char *const folderpath, int folderpath_size) |
| Extracts the folder path from the full file path. More...
|
|
sb_t_err | sb_folder_filter_images (sb_t_folder *const folder, SB_HANDLE module, sb_t_image_info_type image_info_type) |
| Filters images by project and type. More...
|
|
Folders management.
◆ sb_file_extract_folder()
sb_t_err sb_file_extract_folder |
( |
const char *const |
full, |
|
|
char *const |
folderpath, |
|
|
int |
folderpath_size |
|
) |
| |
Extracts the folder path from the full file path.
- Parameters
-
[in] | full | Full file path. |
[out] | folderpath | The folder path extracted. |
[in] | folderpath_size | The size, in bytes, of the string folderpath. |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_file_extract_name()
sb_t_err sb_file_extract_name |
( |
const char *const |
full, |
|
|
int |
with_ext, |
|
|
char *const |
name, |
|
|
int |
name_size |
|
) |
| |
Extracts the file name from the full file path.
- Parameters
-
[in] | full | Full file path. |
[in] | with_ext | If the value is different from 0 the file name includes the extension, otherwise not. |
[out] | name | The file name without path. |
[in] | name_size | The size in bytes of the string name. |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_folder_create()
sb_t_err sb_folder_create |
( |
const char *const |
path | ) |
|
Creates the folder with the specified path.
- Parameters
-
[in] | path | Path to be created. |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_folder_destroy()
◆ sb_folder_erase()
Removes the file with the specified index from the list.
- Parameters
-
[in] | folder | Pointer to the folder. |
[in] | index | Index of the file to remove from the list |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_folder_exist()
sb_t_err sb_folder_exist |
( |
const char *const |
path, |
|
|
int *const |
exist |
|
) |
| |
Checks if the folder with the specified path exists.
- Parameters
-
[in] | path | Path to be verified. |
[out] | exist | The functions sets a value different from 0 if the path exists. |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_folder_filter_images()
Filters images by project and type.
- Parameters
-
folder | Pointer to the folder structure |
module | Handle of the project |
image_info_type | Type of images that need to be kept:
|
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_folder_load()
sb_t_err sb_folder_load |
( |
sb_t_folder **const |
f, |
|
|
const char *const |
path, |
|
|
const char *const |
ext, |
|
|
int |
sort, |
|
|
int |
verbosity |
|
) |
| |
Creates the list of the name of the files in a specified folder.
Files with name does not conform to UTF-8 format are not considered.
- Parameters
-
[out] | f | Pointer to the folder structure |
[in] | path | Name of the folder |
[in] | ext | Extensions of the files. It is possible to concatenate multiple extensions separated by the SB_DELIMITER character, for example "pgm;ppm;bmp". You can use "*" to load all the files. |
[in] | sort | If the value is different from 0 the list of files is sorted in a lexiconic way. |
[in] | verbosity | Verbosity of the message. Set to 0 to disable all the messages. |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
- See also
- sb_folder_destroy
◆ sb_folder_remove()
sb_t_err sb_folder_remove |
( |
const char *const |
path | ) |
|
Deletes a folder and all the files and subfolder contained.
- Parameters
-
[in] | path | Path to be deleted. |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.
◆ sb_folder_rename()
sb_t_err sb_folder_rename |
( |
const char *const |
oldpath, |
|
|
const char *const |
newpath |
|
) |
| |
Renames a folder.
- Parameters
-
[in] | oldpath | Old path name |
[in] | newpath | New path name |
- Returns
- If successful, returns SB_ERR_NONE. Otherwise, it returns an error code sb_t_err.