Blender V4.3
path.cpp File Reference
#include "util/path.h"
#include "util/algorithm.h"
#include "util/map.h"
#include "util/md5.h"
#include "util/string.h"
#include "util/vector.h"
#include <OpenImageIO/filesystem.h>
#include <OpenImageIO/strutil.h>
#include <OpenImageIO/sysutil.h>
#include <stdio.h>
#include <sys/stat.h>
#include <zstd.h>
#include <dirent.h>
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
#include "util/windows.h"

Go to the source code of this file.

Classes

struct  SourceReplaceState
 

Macros

#define DIR_SEP   '/'
 

Typedefs

typedef typedefCCL_NAMESPACE_BEGIN struct stat path_stat_t
 

Functions

static char * path_specials (const string &sub)
 
void path_init (const string &path, const string &user_path)
 
string path_get (const string &sub)
 
string path_user_get (const string &sub)
 
string path_cache_get (const string &sub)
 
string path_filename (const string &path)
 
string path_dirname (const string &path)
 
string path_join (const string &dir, const string &file)
 
string path_escape (const string &path)
 
bool path_is_relative (const string &path)
 
static int path_stat (const string &path, path_stat_t *st)
 
size_t path_file_size (const string &path)
 
bool path_exists (const string &path)
 
bool path_is_directory (const string &path)
 
static void path_files_md5_hash_recursive (MD5Hash &hash, const string &dir)
 
string path_files_md5_hash (const string &dir)
 
static bool create_directories_recursivey (const string &path)
 
void path_create_directories (const string &filepath)
 
bool path_write_binary (const string &path, const vector< uint8_t > &binary)
 
bool path_write_text (const string &path, string &text)
 
bool path_read_binary (const string &path, vector< uint8_t > &binary)
 
bool path_read_compressed_binary (const string &path, vector< uint8_t > &binary)
 
bool path_read_text (const string &path, string &text)
 
bool path_read_compressed_text (const string &path, string &text)
 
uint64_t path_modified_time (const string &path)
 
bool path_remove (const string &path)
 
static string path_source_replace_includes_recursive (const string &source, const string &source_filepath, SourceReplaceState *state)
 
static string line_directive (const SourceReplaceState &state, const string &path, const size_t line_number)
 
static string path_source_handle_preprocessor (const string &preprocessor_line, const string &source_filepath, const size_t line_number, SourceReplaceState *state)
 
string path_source_replace_includes (const string &source, const string &path)
 
FILE * path_fopen (const string &path, const string &mode)
 
static void path_cache_kernel_mark_used (const string &path)
 
bool path_cache_kernel_exists_and_mark_used (const string &path)
 
void path_cache_kernel_mark_added_and_clear_old (const string &new_path, const size_t max_old_kernel_of_same_type)
 

Variables

static string cached_path = ""
 
static string cached_user_path = ""
 
static string cached_xdg_cache_path = ""
 

Macro Definition Documentation

◆ DIR_SEP

#define DIR_SEP   '/'

Typedef Documentation

◆ path_stat_t

typedef typedefCCL_NAMESPACE_BEGIN struct stat path_stat_t

Definition at line 57 of file path.cpp.

Function Documentation

◆ create_directories_recursivey()

static bool create_directories_recursivey ( const string & path)
static

◆ line_directive()

static string line_directive ( const SourceReplaceState & state,
const string & path,
const size_t line_number )
static

Definition at line 797 of file path.cpp.

References length(), path_filename(), state, and string_startswith().

Referenced by path_source_handle_preprocessor().

◆ path_cache_get()

string path_cache_get ( const string & sub)

Definition at line 362 of file path.cpp.

References cached_xdg_cache_path, path_join(), and path_user_get().

◆ path_cache_kernel_exists_and_mark_used()

bool path_cache_kernel_exists_and_mark_used ( const string & path)

Definition at line 992 of file path.cpp.

References path_cache_kernel_mark_used(), and path_exists().

◆ path_cache_kernel_mark_added_and_clear_old()

void path_cache_kernel_mark_added_and_clear_old ( const string & new_path,
const size_t max_old_kernel_of_same_type )

◆ path_cache_kernel_mark_used()

static void path_cache_kernel_mark_used ( const string & path)
static

◆ path_create_directories()

void path_create_directories ( const string & filepath)

Definition at line 648 of file path.cpp.

References create_directories_recursivey(), and path_dirname().

Referenced by path_write_binary().

◆ path_dirname()

◆ path_escape()

string path_escape ( const string & path)

Definition at line 439 of file path.cpp.

References result, and string_replace().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().

◆ path_exists()

◆ path_file_size()

size_t path_file_size ( const string & path)

Definition at line 556 of file path.cpp.

References path_stat().

Referenced by TileManager::finish_write_tiles(), and path_read_binary().

◆ path_filename()

string path_filename ( const string & path)

Definition at line 380 of file path.cpp.

References DIR_SEP.

Referenced by line_directive(), main(), OIIOImageLoader::name(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and xml_read_file().

◆ path_files_md5_hash()

string path_files_md5_hash ( const string & dir)

Definition at line 612 of file path.cpp.

References hash, and path_files_md5_hash_recursive().

◆ path_files_md5_hash_recursive()

static void path_files_md5_hash_recursive ( MD5Hash & hash,
const string & dir )
static

◆ path_fopen()

FILE * path_fopen ( const string & path,
const string & mode )

Definition at line 973 of file path.cpp.

Referenced by MD5Hash::append_file(), path_read_binary(), and path_write_binary().

◆ path_get()

string path_get ( const string & sub)

Definition at line 339 of file path.cpp.

References cached_path, NULL, path_dirname(), path_join(), and path_specials().

Referenced by HdCyclesFileReader::read().

◆ path_init()

void path_init ( const string & path,
const string & user_path )

Definition at line 326 of file path.cpp.

References cached_path, and cached_user_path.

Referenced by BLI_path_join_array(), init_func(), and main().

◆ path_is_directory()

bool path_is_directory ( const string & path)

◆ path_is_relative()

bool path_is_relative ( const string & path)

Definition at line 446 of file path.cpp.

References DIR_SEP.

Referenced by TEST(), TEST(), TEST(), TEST(), TEST(), and xml_read_shader_graph().

◆ path_join()

◆ path_modified_time()

uint64_t path_modified_time ( const string & path)

Definition at line 769 of file path.cpp.

References path_stat().

◆ path_read_binary()

bool path_read_binary ( const string & path,
vector< uint8_t > & binary )

Definition at line 682 of file path.cpp.

References path_file_size(), and path_fopen().

Referenced by path_read_compressed_binary(), and path_read_text().

◆ path_read_compressed_binary()

bool path_read_compressed_binary ( const string & path,
vector< uint8_t > & binary )

Definition at line 709 of file path.cpp.

References path_read_binary(), and string_endswith().

Referenced by path_read_compressed_text().

◆ path_read_compressed_text()

bool path_read_compressed_text ( const string & path,
string & text )

Definition at line 754 of file path.cpp.

References path_exists(), path_read_compressed_binary(), and str.

◆ path_read_text()

bool path_read_text ( const string & path,
string & text )

Definition at line 739 of file path.cpp.

References path_exists(), path_read_binary(), and str.

Referenced by LightManager::add_ies_from_file(), and path_source_handle_preprocessor().

◆ path_remove()

bool path_remove ( const string & path)

◆ path_source_handle_preprocessor()

static string path_source_handle_preprocessor ( const string & preprocessor_line,
const string & source_filepath,
const size_t line_number,
SourceReplaceState * state )
static

◆ path_source_replace_includes()

string path_source_replace_includes ( const string & source,
const string & path )

◆ path_source_replace_includes_recursive()

static string path_source_replace_includes_recursive ( const string & source,
const string & source_filepath,
SourceReplaceState * state )
static

◆ path_specials()

static char * path_specials ( const string & sub)
static

Definition at line 289 of file path.cpp.

References NULL.

Referenced by path_get().

◆ path_stat()

static int path_stat ( const string & path,
path_stat_t * st )
static

Definition at line 550 of file path.cpp.

Referenced by path_file_size(), path_is_directory(), and path_modified_time().

◆ path_user_get()

string path_user_get ( const string & sub)

Definition at line 353 of file path.cpp.

References cached_user_path, path_dirname(), and path_join().

Referenced by path_cache_get().

◆ path_write_binary()

bool path_write_binary ( const string & path,
const vector< uint8_t > & binary )

Definition at line 654 of file path.cpp.

References path_create_directories(), and path_fopen().

Referenced by path_write_text().

◆ path_write_text()

bool path_write_text ( const string & path,
string & text )

Definition at line 674 of file path.cpp.

References path_write_binary().

Variable Documentation

◆ cached_path

string cached_path = ""
static

Definition at line 60 of file path.cpp.

Referenced by blender::io::hydra::cache_or_get_image_file(), path_get(), and path_init().

◆ cached_user_path

string cached_user_path = ""
static

Definition at line 61 of file path.cpp.

Referenced by path_init(), and path_user_get().

◆ cached_xdg_cache_path

string cached_xdg_cache_path = ""
static

Definition at line 62 of file path.cpp.

Referenced by path_cache_get().