|
Blender
V2.93
|
#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 sz, 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 121 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_strdupcat(), 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, ListBase::first, MEM_freeN, MEM_mallocN, MEM_reallocN, dirlink::name, dirlink::next, BuildDirCtx::nrfiles, NULL, opendir(), PATH_MAX, and readdir().
Referenced by BLI_filelist_dir_contents().
Definition at line 61 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 * | dirname, |
| struct direntry ** | r_filelist | ||
| ) |
Scans the contents of the directory named *dirname, and allocates and fills in an array of entries describing them in *filelist.
Definition at line 238 of file BLI_filelist.c.
References bli_builddir(), dirname(), BuildDirCtx::files, MEM_mallocN, BuildDirCtx::nrfiles, and NULL.
Referenced by BKE_appdir_app_templates(), filelist_readjob_list_dir(), fsmenu_read_system(), image_get_udim(), init_iconfile_list(), seq_disk_cache_get_files(), and studiolight_add_files_from_datafolder().
| void BLI_filelist_duplicate | ( | struct direntry ** | dest_filelist, |
| struct direntry *const | src_filelist, | ||
| const unsigned int | nrentries | ||
| ) |
Deep-duplicate of an array of direntries, including the array itself.
Definition at line 437 of file BLI_filelist.c.
References BLI_filelist_entry_duplicate(), and MEM_mallocN.
| 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 | ||
| ) |
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 358 of file BLI_filelist.c.
References FILELIST_DIRENTRY_DATE_LEN, FILELIST_DIRENTRY_TIME_LEN, NULL, and time.
Deep-duplicate of a single direntry.
Definition at line 423 of file BLI_filelist.c.
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 454 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] | ||
| ) |
Convert given entry's modes into human-readable strings.
Definition at line 284 of file BLI_filelist.c.
References BLI_strncpy(), FILELIST_DIRENTRY_MODE_LEN, and types.
| void BLI_filelist_entry_owner_to_string | ( | const struct stat * | st, |
| const bool | UNUSEDcompact, | ||
| char | r_owner[FILELIST_DIRENTRY_OWNER_LEN] | ||
| ) |
Convert given entry's owner into human-readable strings.
Definition at line 334 of file BLI_filelist.c.
References BLI_snprintf(), BLI_strncpy(), and FILELIST_DIRENTRY_OWNER_LEN.
| void BLI_filelist_entry_size_to_string | ( | const struct stat * | st, |
| const uint64_t | sz, | ||
| const bool | UNUSEDcompact, | ||
| char | r_size[FILELIST_DIRENTRY_SIZE_LEN] | ||
| ) |
Convert given entry's size into human-readable strings.
Definition at line 262 of file BLI_filelist.c.
References BLI_str_format_byte_unit(), double(), and size().
| void BLI_filelist_free | ( | struct direntry * | filelist, |
| const unsigned int | nrentries | ||
| ) |
frees storage for an array of direntries, including the array itself.
Definition at line 467 of file BLI_filelist.c.
References BLI_filelist_entry_free(), MEM_freeN, and NULL.
Referenced by BKE_appdir_app_templates(), filelist_readjob_list_dir(), fsmenu_read_system(), image_get_udim(), init_iconfile_list(), seq_disk_cache_get_files(), and studiolight_add_files_from_datafolder().