|
Blender V4.3
|
#include <cerrno>#include <cstdio>#include <cstdlib>#include <sys/types.h>#include <dirent.h>#include <cstring>#include <ctime>#include <sys/stat.h>#include <pwd.h>#include <sys/ioctl.h>#include <unistd.h>#include "MEM_guardedalloc.h"#include "DNA_listBase.h"#include "BLI_fileops.h"#include "BLI_fileops_types.h"#include "BLI_listbase.h"#include "BLI_path_utils.hh"#include "BLI_string.h"#include "BLI_string_utils.hh"Go to the source code of this file.
Classes | |
| struct | BuildDirCtx |
Functions | |
| static int | direntry_cmp (direntry *entry1, direntry *entry2) |
| static void | bli_builddir (BuildDirCtx *dir_ctx, const char *dirname) |
| uint | BLI_filelist_dir_contents (const char *dirname, direntry **r_filelist) |
| void | BLI_filelist_entry_size_to_string (const struct stat *st, const uint64_t st_size_fallback, const bool compact, char r_size[FILELIST_DIRENTRY_SIZE_LEN]) |
| void | BLI_filelist_entry_mode_to_string (const struct stat *st, const bool, char r_mode1[FILELIST_DIRENTRY_MODE_LEN], char r_mode2[FILELIST_DIRENTRY_MODE_LEN], char r_mode3[FILELIST_DIRENTRY_MODE_LEN]) |
| void | BLI_filelist_entry_owner_to_string (const struct stat *st, const bool, char r_owner[FILELIST_DIRENTRY_OWNER_LEN]) |
| void | BLI_filelist_entry_datetime_to_string (const struct stat *st, const int64_t ts, const bool compact, char r_time[FILELIST_DIRENTRY_TIME_LEN], char r_date[FILELIST_DIRENTRY_DATE_LEN], bool *r_is_today, bool *r_is_yesterday) |
| void | BLI_filelist_entry_duplicate (direntry *dst, const direntry *src) |
| void | BLI_filelist_duplicate (direntry **dest_filelist, direntry *const src_filelist, const uint nrentries) |
| void | BLI_filelist_entry_free (direntry *entry) |
| void | BLI_filelist_free (direntry *filelist, const uint nrentries) |
|
static |
Scans the directory named *dirname and appends entries for its contents to files.
Definition at line 109 of file BLI_filelist.cc.
References BLI_access(), BLI_addhead(), BLI_freelist(), BLI_path_parent_dir(), BLI_path_slash_is_native_compat(), BLI_stat(), BLI_strdup(), BLI_string_joinN, BLI_strncpy_rlen(), closedir(), dirent::d_name, direntry_cmp(), dirname(), FILE_MAXDIR, FILENAME_CURRENT, FILENAME_IS_CURRENT, FILENAME_IS_CURRPAR, FILENAME_IS_PARENT, FILENAME_PARENT, BuildDirCtx::files, BuildDirCtx::files_num, ListBase::first, int, MEM_freeN(), MEM_mallocN, MEM_reallocN, dirlink::name, dirlink::next, opendir(), readdir(), SEP, STRNCPY, and UNLIKELY.
Referenced by BLI_filelist_dir_contents().
Scans the contents of the directory named dirname, and allocates and fills in an array of entries describing them in r_filelist.
r_filelist array. Definition at line 227 of file BLI_filelist.cc.
References bli_builddir(), dirname(), BuildDirCtx::files, BuildDirCtx::files_num, and MEM_mallocN.
Referenced by BKE_appdir_app_templates(), BKE_image_get_tile_info(), BKE_image_tile_filepath_exists(), blf_load_datafiles_dir(), blender::gpu::VKShaderCompiler::cache_dir_clear_old(), blender::ed::asset::index::AssetLibraryIndex::collect_preexisting_file_indices(), blender::compositor::DebugInfo::delete_operation_exports(), blender::bke::bake::directory_is_empty(), filelist_readjob_list_dir(), blender::bke::bake::find_sorted_meta_files(), fsmenu_read_system(), blender::bke::bake::pack_files_from_directory(), blender::io::usd::process_usdz_textures(), seq_disk_cache_get_files(), and studiolight_add_files_from_datafolder().
| void BLI_filelist_duplicate | ( | struct direntry ** | dest_filelist, |
| struct direntry *const | src_filelist, | ||
| unsigned int | nrentries ) |
Deep-duplicate of a direntry array including the array itself.
Definition at line 416 of file BLI_filelist.cc.
References BLI_filelist_entry_duplicate(), and MEM_mallocN.
| void BLI_filelist_entry_datetime_to_string | ( | const struct stat * | st, |
| int64_t | ts, | ||
| bool | compact, | ||
| char | r_time[FILELIST_DIRENTRY_TIME_LEN], | ||
| char | r_date[FILELIST_DIRENTRY_DATE_LEN], | ||
| bool * | r_is_today, | ||
| bool * | r_is_yesterday ) |
Convert given entry's time into human-readable strings.
| r_is_today | optional, returns true if the date matches today's. |
| r_is_yesterday | optional, returns true if the date matches yesterday's. |
Definition at line 343 of file BLI_filelist.cc.
References FILELIST_DIRENTRY_DATE_LEN, FILELIST_DIRENTRY_TIME_LEN, and time.
Referenced by file_draw_tooltip_custom_func(), filelist_get_details_column_string(), uiTemplateRecentFiles_tooltip_func(), and wm_open_mainfile_get_description().
Definition at line 405 of file BLI_filelist.cc.
References MEM_dupallocN, direntry::path, and direntry::relname.
Referenced by BLI_filelist_duplicate().
| void BLI_filelist_entry_free | ( | struct direntry * | entry | ) |
Frees storage for a single direntry, not the direntry itself.
Definition at line 431 of file BLI_filelist.cc.
References MEM_freeN(), direntry::path, and direntry::relname.
Referenced by BLI_filelist_free().
| void BLI_filelist_entry_mode_to_string | ( | const struct stat * | st, |
| bool | compact, | ||
| char | r_mode1[FILELIST_DIRENTRY_MODE_LEN], | ||
| char | r_mode2[FILELIST_DIRENTRY_MODE_LEN], | ||
| char | r_mode3[FILELIST_DIRENTRY_MODE_LEN] ) |
Convert given entry's modes into human-readable strings.
Definition at line 276 of file BLI_filelist.cc.
References BLI_strncpy(), FILELIST_DIRENTRY_MODE_LEN, and UNUSED_VARS.
| void BLI_filelist_entry_owner_to_string | ( | const struct stat * | st, |
| bool | compact, | ||
| char | r_owner[FILELIST_DIRENTRY_OWNER_LEN] ) |
Convert given entry's owner into human-readable strings.
Definition at line 324 of file BLI_filelist.cc.
References BLI_snprintf(), BLI_strncpy(), FILELIST_DIRENTRY_OWNER_LEN, and UNUSED_VARS.
| void BLI_filelist_entry_size_to_string | ( | const struct stat * | st, |
| uint64_t | st_size_fallback, | ||
| bool | compact, | ||
| char | r_size[FILELIST_DIRENTRY_SIZE_LEN] ) |
Convert given entry's size into human-readable strings.
Definition at line 248 of file BLI_filelist.cc.
References BLI_str_format_byte_unit(), BLI_str_format_byte_unit_compact(), and double().
Referenced by file_draw_tooltip_custom_func(), filelist_get_details_column_string(), uiTemplateRecentFiles_tooltip_func(), and wm_open_mainfile_get_description().
Frees storage for an array of direntry, including the array itself.
Definition at line 441 of file BLI_filelist.cc.
References BLI_filelist_entry_free(), and MEM_freeN().
Referenced by BKE_appdir_app_templates(), BKE_image_get_tile_info(), BKE_image_tile_filepath_exists(), blf_load_datafiles_dir(), blender::gpu::VKShaderCompiler::cache_dir_clear_old(), blender::ed::asset::index::AssetLibraryIndex::collect_preexisting_file_indices(), blender::compositor::DebugInfo::delete_operation_exports(), blender::bke::bake::directory_is_empty(), filelist_readjob_list_dir(), blender::bke::bake::find_sorted_meta_files(), fsmenu_read_system(), blender::bke::bake::pack_files_from_directory(), blender::io::usd::process_usdz_textures(), seq_disk_cache_get_files(), and studiolight_add_files_from_datafolder().
Definition at line 49 of file BLI_filelist.cc.
References BLI_strcasecmp_natural(), FILENAME_IS_CURRENT, FILENAME_IS_PARENT, direntry::relname, S_ISDIR, S_ISREG, and direntry::type.
Referenced by bli_builddir().