Blender
V3.3
|
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <time.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_util.h"
#include "BLI_string.h"
#include "../imbuf/IMB_imbuf.h"
Go to the source code of this file.
Classes | |
struct | BuildDirCtx |
Functions | |
static int | bli_compare (struct direntry *entry1, struct direntry *entry2) |
static void | bli_builddir (struct BuildDirCtx *dir_ctx, const char *dirname) |
unsigned int | BLI_filelist_dir_contents (const char *dirname, struct direntry **r_filelist) |
void | BLI_filelist_entry_size_to_string (const struct stat *st, const uint64_t st_size_fallback, const bool UNUSED(compact), char r_size[FILELIST_DIRENTRY_SIZE_LEN]) |
void | BLI_filelist_entry_mode_to_string (const struct stat *st, const bool UNUSED(compact), 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 UNUSED(compact), 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 (struct direntry *dst, const struct direntry *src) |
void | BLI_filelist_duplicate (struct direntry **dest_filelist, struct direntry *const src_filelist, const unsigned int nrentries) |
void | BLI_filelist_entry_free (struct direntry *entry) |
void | BLI_filelist_free (struct direntry *filelist, const unsigned int nrentries) |
|
static |
Scans the directory named *dirname and appends entries for its contents to files.
Definition at line 107 of file BLI_filelist.c.
References BLI_access(), BLI_addhead(), bli_compare(), BLI_freelist(), BLI_join_dirfile(), BLI_path_parent_dir(), BLI_stat(), BLI_strdup(), BLI_strncpy(), closedir(), dirent::d_name, dirname(), file, FILE_MAXDIR, FILENAME_CURRENT, FILENAME_IS_CURRENT, FILENAME_IS_CURRPAR, FILENAME_IS_PARENT, FILENAME_PARENT, BuildDirCtx::files, BuildDirCtx::files_num, ListBase::first, MEM_freeN, MEM_mallocN, MEM_reallocN, dirlink::name, dirlink::next, NULL, opendir(), PATH_MAX, and readdir().
Referenced by BLI_filelist_dir_contents().
Definition at line 47 of file BLI_filelist.c.
References BLI_strcasecmp_natural(), FILENAME_IS_CURRENT, FILENAME_IS_PARENT, direntry::relname, S_ISDIR, S_ISREG, and direntry::type.
Referenced by bli_builddir().
unsigned int BLI_filelist_dir_contents | ( | const char * | dir, |
struct direntry ** | r_filelist | ||
) |
Scans the contents of the directory named dir
, and allocates and fills in an array of entries describing them in r_filelist
.
r_filelist
array. Definition at line 218 of file BLI_filelist.c.
References bli_builddir(), dirname(), BuildDirCtx::files, BuildDirCtx::files_num, MEM_mallocN, and NULL.
Referenced by BKE_appdir_app_templates(), BKE_image_get_tile_info(), BKE_image_tile_filepath_exists(), BLF_load_font_stack(), blender::compositor::DebugInfo::delete_operation_exports(), filelist_readjob_list_dir(), fsmenu_read_system(), init_iconfile_list(), blender::ed::asset::index::AssetLibraryIndex::init_unused_index_files(), 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 396 of file BLI_filelist.c.
References BLI_filelist_entry_duplicate(), MEM_mallocN, and src.
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 323 of file BLI_filelist.c.
References FILELIST_DIRENTRY_DATE_LEN, FILELIST_DIRENTRY_TIME_LEN, NULL, usdtokens::st(), and time.
Referenced by filelist_get_details_column_string(), and wm_open_mainfile_description().
Deep-duplicate of a single direntry.
Definition at line 385 of file BLI_filelist.c.
References MEM_dupallocN, direntry::path, direntry::relname, and src.
Referenced by BLI_filelist_duplicate().
Frees storage for a single direntry, not the direntry itself.
Definition at line 410 of file BLI_filelist.c.
References MEM_freeN, direntry::path, and direntry::relname.
Referenced by BLI_filelist_free().
void BLI_filelist_entry_mode_to_string | ( | const struct stat * | st, |
const bool | UNUSEDcompact, | ||
char | r_mode1[FILELIST_DIRENTRY_MODE_LEN], | ||
char | r_mode2[FILELIST_DIRENTRY_MODE_LEN], | ||
char | r_mode3[FILELIST_DIRENTRY_MODE_LEN] | ||
) |
Definition at line 258 of file BLI_filelist.c.
References BLI_strncpy(), FILELIST_DIRENTRY_MODE_LEN, usdtokens::st(), and types.
void BLI_filelist_entry_owner_to_string | ( | const struct stat * | st, |
const bool | UNUSEDcompact, | ||
char | r_owner[FILELIST_DIRENTRY_OWNER_LEN] | ||
) |
Definition at line 305 of file BLI_filelist.c.
References BLI_snprintf(), BLI_strncpy(), FILELIST_DIRENTRY_OWNER_LEN, and usdtokens::st().
void BLI_filelist_entry_size_to_string | ( | const struct stat * | st, |
const uint64_t | st_size_fallback, | ||
const bool | UNUSEDcompact, | ||
char | r_size[FILELIST_DIRENTRY_SIZE_LEN] | ||
) |
Definition at line 239 of file BLI_filelist.c.
References BLI_str_format_byte_unit(), double(), size(), and usdtokens::st().
Frees storage for an array of direntry, including the array itself.
Definition at line 420 of file BLI_filelist.c.
References BLI_filelist_entry_free(), MEM_freeN, and NULL.
Referenced by BKE_appdir_app_templates(), BKE_image_get_tile_info(), BKE_image_tile_filepath_exists(), BLF_load_font_stack(), blender::compositor::DebugInfo::delete_operation_exports(), filelist_readjob_list_dir(), fsmenu_read_system(), init_iconfile_list(), blender::ed::asset::index::AssetLibraryIndex::init_unused_index_files(), seq_disk_cache_get_files(), and studiolight_add_files_from_datafolder().