7 for(
t_size walk = p_base; p_path[walk]; walk++) {
8 if (p_path[walk] ==
'\\') {
9 temp.set_string(p_path,walk);
10 try {filesystem::g_create_directory(temp.get_ptr(),p_abort);}
catch(exception_io_already_exists) {}
27 if (*p_path !=
'\\')
return false;
29 if (*p_path !=
'\\')
return false;
34 if (*p_path !=
'\\')
return false;
46 while(p_path[walk] ==
'\\') walk++;
47 while(p_path[walk] != 0 && p_path[walk] !=
'\\') walk++;
48 while(p_path[walk] ==
'\\') walk++;
49 while(p_path[walk] != 0 && p_path[walk] !=
'\\') walk++;
50 while(p_path[walk] ==
'\\') walk++;
53 pfc::throw_exception_with_message< exception_io > (
"Could not create directory structure; unknown path format");
60 return c==
' ' || c==
'.';
67 if (parent && *parent)
72 bool last_char_is_dir_sep =
true;
78 const char * ptr = filename+1;
80 if (*ptr!=
'\\' && *ptr!=
'/') out.
add_string(filename,ptr-filename);
82 if (*filename==0)
break;
87 if (allow_new_dirs && (*filename==
'\\' || *filename==
'/'))
89 if (!last_char_is_dir_sep)
91 if (really_create_dirs)
try{filesystem::g_create_directory(out,p_abort);}
catch(exception_io_already_exists){}
93 last_char_is_dir_sep =
true;
102 last_char_is_dir_sep =
false;
110 if (extension && *extension)
121 for(
t_size walk = 0; ; ++walk) {
122 const char c = formatted[walk];
124 if (curSegBase < walk) {
125 pfc::string seg( formatted + curSegBase, walk - curSegBase );
129 curSegBase = walk + 1;
138 handle->format_title(p_hook,formatted,spec,&filter);
158 for(
t_size walk = 0; walk < p_dataLength; ++walk) {
159 char c = p_data[walk];
void format_filename_ex(const metadb_handle_ptr &handle, titleformat_hook *p_hook, titleformat_object::ptr spec, const char *suffix, pfc::string_base &out)
void create_path(const char *p_path, abort_callback &p_abort)
static bool test_netpath(const char *p_path)
void fix_dir_separator(char c= '\\')
bool char_is_ascii_alpha(char p_char)
string combine(string basePath, string fileName)
static bool test_localpath(const char *p_path)
void make_path(const char *parent, const char *filename, const char *extension, bool allow_new_dirs, pfc::string8 &out, bool really_create_dirs, abort_callback &p_abort)
void write(const GUID &p_inputType, pfc::string_receiver &p_out, const char *p_data, t_size p_dataLength)
string validateFileName(string name, bool allowWC)
void format_filename(const metadb_handle_ptr &handle, titleformat_hook *p_hook, const char *spec, pfc::string_base &out)
"String parameter" helper class, to use in function parameters, allowing functions to take any type o...
void add_string(const char *p_string, t_size p_length=~0)
virtual void add_string(const char *p_string, t_size p_string_size=~0)=0
static bool is_bad_dirchar(char c)
string8_fastalloc string_formatter
pfc::string sanitize_formatted_path(pfc::stringp str, bool allowWC=false)
This is free and unencumbered software released into the public domain Anyone is free to compile
static void create_path_internal(const char *p_path, t_size p_base, abort_callback &p_abort)
void add_char(t_uint32 c)
int strcmp_partial(const char *str, const char *substr)
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
New EXPERIMENTAL string class, allowing efficient copies and returning from functions. Does not implement the string_base interface so you still need string8 in many cases. Safe to pass between DLLs, but since a reference is used, objects possibly created by other DLLs must be released before owning DLLs are unloaded.
static bool is_valid_netpath_char(char p_char)
bool is_path_bad_char(unsigned c)
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
bool char_is_ascii_alphanumeric(char p_char)
string8_t< pfc::alloc_fast_aggressive > string8_fastalloc
t_size length() const
For compatibility with old conventions.