23 string label =
u.label ();
24 string protocol=
u.protocol ();
25 return ((label ==
"") || (label ==
"concat") || (label ==
"root")) &&
26 (protocol ==
"default" || protocol ==
"file");
110 if (
filter ==
"")
return true;
118 if ((
suf !=
"exe") && (
suf !=
"bat") && (
suf !=
"com")) {
129 for (i= 0; i < n; i++)
217 for (
int i= 0; i <
N (
dir); i++)
227 string label=
u.label ();
228 if (label ==
"none" || label ==
"root" || label ==
"wildcard")
return;
250 string label=
u.label ();
251 if (label ==
"none" || label ==
"root" || label ==
"wildcard")
return;
290#if defined(OS_WIN) || defined(OS_MINGW)
327 string label=
u.label ();
328 if (label ==
"none" || label ==
"root" || label ==
"wildcard")
return;
396 return file_status (
true,
"Must be a local and single file");
401 return file_status (
true,
"File is not readable", path);
405 return file_status (
true,
"Failed to init the file", path);
428 return file_status (
true,
"Unexpected behavior during reading", path,
450 "invalid cast from tb_byte_t* to char*");
452 return file_status (
true,
"Must be an absolute path");
462 return file_status (
true,
"File not writeable", path);
470 return file_status (
true,
"Fail to lock file", path);
484 return file_status (
true,
"Unexpected behavior during writting", path,
503 return file_status (
true,
"Must be a local and single file");
512 return file_status (
true,
"File to append is not found or not appendable",
521 return file_status (
true,
"Fail to lock file", path);
537 return file_status (
true,
"Unexpected behavior during appending", path,
557 cerr <<
"Append failed for " <<
to <<
LF;
bool starts(string s, const char *what)
string replace(string s, string what, string by)
int N(array< T > a)
Get the length of the array.
#define TM_FAILED(msg)
Macro used to throw an exception with a specified error message.
#define ASSERT(cond, msg)
Macro used to assert that a condition is true, and throw an exception with an error message if the co...
The list class represents a linked list.
void tm_delete_array(C *Ptr)
void string_save(const string &s, url u)
bool load_string(url u, string &s, bool fatal)
url url_temp(string suffix)
bool is_newer(url which, url than)
url subdirectories(url u)
void move(url u1, url u2)
bool append_string(url u, const string &s, bool fatal)
static url find_the_first_exist(const url &u)
lookup the first exist path in a bunch of url, if all url does not exist, then the last one will be u...
bool is_local_and_single(url u)
bool is_symbolic_link(url u)
static tb_long_t tb_directory_walk_func(tb_char_t const *path, tb_file_info_t const *info, tb_cpointer_t priv)
void string_append_to_file(const string &s, url u)
void copy(url u1, url u2)
file_status append_string_try(url u, const string &s)
static bool cleanup_and_return_finally(const file_status &status, const url &u, bool fatal, const string &reason)
file_status save_string_try(url u, const string &s)
bool save_string(url u, const string &s, bool fatal)
string string_load(url u)
file_status load_string_try(url u, string &s)
void append_to(url what, url to)
static string as_local_path(url u)
bool is_of_type(url name, string filter)
array< string > read_directory(url u, bool &error_flag)
list< T > tail(list< T > l, int n=1)
Get all but the first n items of a list.
list< T > head(list< T > l, int n=1)
Get the first n items of a list.
char * as_charp(string s)
string as_string(int16_t i)
file_status(bool failed_, const char *msg="", const char *path_=NULL, const tb_byte_t *buffer_=NULL)
string suffix(url u, bool use_locase)
url url_system(string name)
url reroot(url u, string protocol)
static url expand(url u1, url u2)
url glue(url u, string s)