31# define _WIN32_IE 0x0501
49static bool BLI_path_is_abs_win32(
const char *path);
50static int BLI_path_win32_prefix_len(
const char *path);
59#define FILENAME_FRAME_CHARS_MAX FILE_MAX
63 const size_t head_maxncpy,
65 const size_t tail_maxncpy,
75 uint nums = 0, nume = 0;
77 bool found_digit =
false;
80 const uint lslash_len = lslash !=
nullptr ? int(lslash - path) : 0;
81 const uint name_end =
uint(extension - path);
83 for (i = name_end - 1; i >= int(lslash_len); i--) {
84 if (isdigit(path[i])) {
102 const long long int ret = strtoll(&(path[nums]),
nullptr, 10);
108 BLI_strncpy(head, path, std::min<size_t>(head_maxncpy, nums + 1));
111 *r_digits_len = nume - nums + 1;
123 BLI_strncpy(head, path, std::min<size_t>(head_maxncpy, name_end + 1));
132 const size_t path_maxncpy,
146 BLI_snprintf(path, path_maxncpy,
"%s%.*d%s", head, numlen, std::max(0, pic), tail);
155 const char *path_orig = path;
156 int path_len = strlen(path);
162 if (check_blend_relative_prefix && (path[0] ==
'/' && path[1] ==
'/')) {
169 while (path[i] ==
SEP) {
174 memmove(path, path + i, (path_len - i) + 1);
183 if (path_orig == path) {
188 path += path_unc_len;
189 path_len -= path_unc_len;
198 const bool is_relative = path[0] && (path[0] !=
SEP);
217 for (
int i = path_len - 1; i > 0; i--) {
219 if (path[i] ==
SEP) {
224 if (path[i - 1] ==
SEP) {
227 else if (i >= 2 && path[i - 1] ==
'.' && path[i - 2] ==
SEP) {
236 memmove(path + i, path + i_end, (path_len - i_end) + 1);
237 path_len -= i_end - i;
245 if ((path_len > 2) && (path[0] ==
'.') && (path[1] ==
SEP)) {
246 memmove(path, path + 2, (path_len - 2) + 1);
262#define IS_PARENT_DIR(p) ((p)[0] == '.' && (p)[1] == '.' && ELEM((p)[2], SEP, '\0'))
265 char *path_first_non_slash_part = path;
266 while (*path_first_non_slash_part && *path_first_non_slash_part ==
SEP) {
267 path_first_non_slash_part++;
272 char *start_base = path_first_non_slash_part;
279 if (start_base < path + path_len) {
281 char *start = start_base;
285 (start_temp = ((start <= &path[path_len - 3]) &&
287 &path[path_len - 3] :
290 start = start_temp + 1;
294 char *end_all = start;
309 }
while (start_base < start && *(start - 1) !=
SEP);
313 }
while ((start != start_base) && (end < end_all));
315 if (end > path + path_len) {
320 BLI_assert(start < end && start >= start_base);
321 const size_t start_len = path_len - (end - path);
322 memmove(start, end, start_len + 1);
323 path_len -= end - start;
326 if (start == start_base && (end != end_all)) [[unlikely]] {
327 start_base += (end_all - end);
328 start = (start_base < path + path_len) ? start_base : start_base - 1;
335 BLI_assert((start_base - path_first_non_slash_part) % 3 == 0);
339 !(path_len >= 3 &&
STREQ(&path[path_len - 3],
SEP_STR ".."))));
346 if (path_len == 0 && (path == path_orig)) {
357 if (start_base != path_first_non_slash_part) {
358 char *start = start_base > path + path_len ? start_base - 1 : start_base;
362 const size_t start_len = path_len - (start - path);
364 memmove(path_first_non_slash_part, start, start_len + 1);
365 path_len -= start - path_first_non_slash_part;
374 return (path - path_orig) + path_len;
390 if (dir[0] ==
'\0') {
408 if (path_len > 1 && path[path_len - 1] ==
SEP) {
411 if (BLI_path_win32_prefix_len(path) + 1 < path_len)
415 path[path_len] =
'\0';
423#define INVALID_CHARS \
424 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
425 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
427#define INVALID_TOKENS "<>"
435 bool changed =
false;
457 const char *invalid_names[] = {
458 "con",
"prn",
"aux",
"null",
"com1",
"com2",
"com3",
"com4",
459 "com5",
"com6",
"com7",
"com8",
"com9",
"lpt1",
"lpt2",
"lpt3",
460 "lpt4",
"lpt5",
"lpt6",
"lpt7",
"lpt8",
"lpt9",
nullptr,
476 for (iname = invalid_names; *iname; iname++) {
477 if (strstr(filename_lower, *iname) == filename_lower) {
478 const size_t iname_len = strlen(*iname);
482 if ((iname_len ==
len) || (filename_lower[iname_len] ==
'.')) {
490 MEM_delete(filename_lower);
506 char *curr_slash, *curr_path = path;
507 bool changed =
false;
508 bool skip_first =
false;
511 if (BLI_path_is_abs_win32(path)) {
520 const char backup = *curr_slash;
526 curr_path = curr_slash + 1;
527 *curr_slash = backup;
538 return path[0] ==
'/' && path[1] ==
'/';
543 return path[0] ==
'\\' && path[1] ==
'\\';
555 if ((path[2] ==
'?') && (path[3] ==
'\\')) {
567static int BLI_path_win32_prefix_len(
const char *path)
578 return isalpha(path[0]) && (path[1] ==
':');
583 return isalpha(path[0]) && (path[1] ==
':') && (path[2] ==
'\0');
588 return isalpha(path[0]) && (path[1] ==
':') &&
ELEM(path[2],
'\\',
'/');
601static bool BLI_path_is_abs_win32(
const char *path)
608static wchar_t *next_slash(
wchar_t *path)
610 wchar_t *slash = path;
611 while (*slash && *slash !=
L'\\') {
618static void BLI_path_add_slash_to_share(
wchar_t *uncpath)
620 wchar_t *slash_after_server = next_slash(uncpath + 2);
621 if (*slash_after_server) {
622 wchar_t *slash_after_share = next_slash(slash_after_server + 1);
623 if (!(*slash_after_share)) {
624 slash_after_share[0] =
L'\\';
625 slash_after_share[1] =
L'\0';
630static void BLI_path_unc_to_short(
wchar_t *unc)
632 int len = wcslen(unc);
638 if ((
len > 3) && (unc[0] ==
L'\\') && (unc[1] ==
L'\\') && (unc[2] ==
L'?') &&
639 ELEM(unc[3],
L'\\',
L'/'))
642 if ((
len > 5) && (unc[5] ==
L':')) {
643 memmove(unc, unc + 4, (
len - 4 + 1) *
sizeof(*unc));
645 else if ((
len > 7) && (wcsncmp(&unc[4],
L"UNC", 3) == 0) &&
ELEM(unc[7],
L'\\',
L'/')) {
647 memmove(unc + 2, unc + 8, (
len - 8 + 1) *
sizeof(*unc));
652void BLI_path_normalize_unc(
char *path,
int path_maxncpy)
655 BLI_path_normalize_unc_16(tmp_16);
660void BLI_path_normalize_unc_16(
wchar_t *path_16)
662 BLI_path_unc_to_short(path_16);
663 BLI_path_add_slash_to_share(path_16);
677 const size_t path_maxncpy,
678 const char *basepath,
680 const bool blend_relative)
686 const char *base_dir_end;
695 if (basepath[0] ==
'\0') {
714 for (
int offset = 0; base_path[offset] && num_slashes < 4; offset++) {
715 const char base_ch = base_path[offset];
716 const char path_ch = path[offset];
718 if (
ELEM(base_ch,
'\\',
'/')) {
721 if (path_ch ==
'\0' && num_slashes == 4) {
724 if (!
ELEM(path_ch,
'\\',
'/')) {
728 else if (tolower(base_ch) != tolower(path_ch)) {
733 else if ((base_path[1] ==
':' && path[1] ==
':') &&
734 (tolower(base_path[0]) != tolower(path[0])))
758 base_path[base_dir_end - base_path + 1] =
'\0';
766 while ((base_path[i] !=
'\0') && tolower(base_path[i]) == tolower(path[i])) {
768 while ((base_path[i] !=
'\0') && base_path[i] == path[i]) {
771 if (base_path[i - 1] ==
'/') {
772 base_offset = path_offset = i;
776 if ((path[i] ==
'\0') && (base_path[i] ==
'/')) {
782 if (base_offset == 0) {
788 char *result_iter =
result + (blend_relative ? 2 : 0);
791 for (
const char *base_iter = base_path + base_offset; *base_iter; base_iter++) {
792 if (*base_iter ==
'/') {
797 result_iter,
"../",
sizeof(
result) - (result_iter -
result));
802 result_iter, path + path_offset,
sizeof(
result) - (result_iter -
result));
817 const bool walk_up =
true;
818 const bool blend_relative =
true;
821 if (
BLI_strnlen(basepath, 3) > 2 && !BLI_path_is_abs_win32(basepath)) {
826 char *base_path_after_root = &base_path[2];
827 if (!
ELEM(basepath[0],
'\\',
'/')) {
828 base_path_after_root++;
831 base_path_after_root, basepath,
sizeof(base_path) - (base_path_after_root - base_path));
840bool BLI_path_suffix(
char *path,
size_t path_maxncpy,
const char *suffix,
const char *sep)
844 const size_t suffix_len = strlen(suffix);
845 const size_t sep_len = strlen(sep);
847 const size_t extension_len = strlen(extension);
848 const size_t path_end = extension - path;
849 const size_t path_len = path_end + extension_len;
850 if (path_len + sep_len + suffix_len >= path_maxncpy) {
855 memmove(extension + (sep_len + suffix_len), extension, extension_len);
857 char *c = path + path_end;
859 memcpy(c, sep, sep_len);
863 memcpy(c, suffix, suffix_len);
873 const char *path_end = path + path_len - 1;
874 const char *p = path_end;
892 if ((p > path) && (p != path_end)) {
906 int tail_ofs = 0, tail_len = 0;
913 if (path[tail_ofs] ==
'.') {
919 BLI_assert(!((tail_len == 2) && (path[tail_ofs] ==
'.') && (path[tail_ofs + 1] ==
'.')));
920 path[tail_ofs] =
'\0';
926 bool valid_path =
true;
932 return (valid_path && path[0]);
947 uint ch_sta, ch_end, i;
950 for (i = 0; path[i] !=
'\0'; i++) {
951 if (
ELEM(path[i],
'\\',
'/')) {
954 else if (path[i] ==
'#') {
957 while (path[ch_end] ==
'#') {
967 *r_char_start = ch_sta;
968 *r_char_end = ch_end;
986 if (strrchr(file,
'#') ==
nullptr) {
987 int len = strlen(file);
988 if (
size_t(file - path) +
size_t(
len + digits) >= path_maxncpy) {
1013 SNPRINTF(frame_str,
"%.*d", ch_span, frame);
1033 SNPRINTF(frame_str,
"%.*d-%.*d", ch_span, sta, ch_span, end);
1042 if (*path ==
'\0') {
1050 const char *c = file_ext;
1054 while (c-- != file && isdigit(*c)) {
1059 if (digits_len == 0) {
1063 *r_digits_len = digits_len;
1067 const long long num = strtoll(c,
nullptr, 10);
1072 *r_frame = int(
num);
1080 if (*path ==
'\0') {
1092 while (c-- != file && isdigit(*c)) {
1098 const long long num = strtoll(c,
nullptr, 10);
1101 while (digits_len--) {
1117 int ch_sta_dummy, ch_end_dummy;
1126 int strip_offset = 0;
1127 while (
ELEM(name[strip_offset],
'_',
' ')) {
1131 int display_name_len =
BLI_strncpy_rlen(display_name, name + strip_offset, display_name_maxncpy);
1144 bool all_lower =
true;
1145 for (
int i = 0; display_name[i]; i++) {
1146 if (isupper(display_name[i])) {
1154 bool prevspace =
true;
1155 for (
int i = 0; display_name[i]; i++) {
1157 display_name[i] = toupper(display_name[i]);
1160 prevspace = isspace(display_name[i]);
1177 if (*path ==
'\0') {
1183 if (!wasrelative && !BLI_path_is_abs_win32(path)) {
1184 const size_t root_dir_len = 3;
1191 BLI_strncpy(tmp + root_dir_len, p,
sizeof(tmp) - root_dir_len);
1207 tmp[1] = tolower(tmp[0]);
1238 const int baselen = int(lslash - base) + 1;
1242 memcpy(tmp, base, baselen);
1243 BLI_strncpy(tmp + baselen, path,
sizeof(tmp) - baselen);
1272 bool is_abs =
false;
1275 if (BLI_path_is_abs_win32(path)) {
1279 if (path[0] ==
'/') {
1299 printf(
"Could not get the current working directory - $PWD for an unknown reason.\n");
1313bool BLI_path_program_extensions_add_win32(
char *program_name,
const size_t program_name_maxncpy)
1315 bool retval =
false;
1319 if ((type == 0) ||
S_ISDIR(type)) {
1321 const int ext_max = 12;
1324 const int program_name_len = strlen(program_name);
1325 char *
filename =
static_cast<char *
>(alloca(program_name_len + ext_max));
1327 const char *ext_next;
1330 memcpy(
filename, program_name, program_name_len);
1331 filename_ext =
filename + program_name_len;
1335 ext_next = strchr(ext,
';');
1336 ext_len = ext_next ? ((ext_next++) - ext) : strlen(ext);
1338 if (ext_len < ext_max) [[likely]] {
1339 memcpy(filename_ext, ext, ext_len);
1340 filename_ext[ext_len] =
'\0';
1343 if (type && (!
S_ISDIR(type))) {
1349 }
while ((ext = ext_next));
1361 const size_t program_filepath_maxncpy,
1362 const char *program_name)
1367 bool retval =
false;
1370 const char separator =
';';
1372 const char separator =
':';
1381 temp = strchr(path, separator);
1383 memcpy(filepath_test, path, temp - path);
1384 filepath_test[temp - path] = 0;
1391 BLI_path_append(filepath_test, program_filepath_maxncpy, program_name);
1394 BLI_path_program_extensions_add_win32(filepath_test,
sizeof(filepath_test))
1400 BLI_strncpy(program_filepath, filepath_test, program_filepath_maxncpy);
1407 if (retval ==
false) {
1408 *program_filepath =
'\0';
1416#if (defined(_WIN32) || defined(_WIN64))
1422 setenv(env, val, 1);
1440 const char *
result =
nullptr;
1443 static wchar_t buffer[32768];
1447 if (GetEnvironmentVariableW(env_16, buffer,
ARRAY_SIZE(buffer))) {
1451 if (strlen(res_utf8) + 1 <
sizeof(buffer)) {
1454 memcpy(buffer, res_utf8, strlen(res_utf8) + 1);
1455 result = (
const char *)buffer;
1469 const size_t path_len,
1471 const size_t ext_len)
1476 return (((path_len == 0 || ext_len == 0 || ext_len >= path_len) == 0) &&
1487 const size_t path_len = strlen(path);
1493 va_start(args, path);
1495 while ((ext =
static_cast<const char *
>(va_arg(args,
void *)))) {
1509 const size_t path_len = strlen(path);
1512 while (ext_array[i]) {
1524 const char *ext_step = ext_fnmatch;
1527 while (ext_step[0]) {
1528 const char *ext_next;
1531 if ((ext_next = strchr(ext_step,
';'))) {
1532 len_ext = ext_next - ext_step + 1;
1533 BLI_strncpy(pattern, ext_step, (len_ext >
sizeof(pattern)) ?
sizeof(pattern) : len_ext);
1539 if (fnmatch(pattern, path, FNM_CASEFOLD) == 0) {
1542 ext_step += len_ext;
1550 bool only_wildcards =
false;
1552 for (
size_t i = strlen(ext_fnmatch); i-- > 0;) {
1553 if (ext_fnmatch[i] ==
';') {
1556 if (only_wildcards) {
1557 ext_fnmatch[i] =
'\0';
1562 if (!
ELEM(ext_fnmatch[i],
'?',
'*')) {
1567 only_wildcards =
true;
1579 const size_t ext_len = strlen(ext);
1580 if ((path_ext - path) + ext_len >= path_maxncpy) {
1584 memcpy(path_ext, ext, ext_len + 1);
1591 if (path_ext ==
nullptr) {
1605 if (
STREQ(path_ext, ext)) {
1609 const size_t path_len = strlen(path);
1610 const size_t ext_len = strlen(ext);
1613 for (a = path_len - 1; a >= 0; a--) {
1614 if (path[a] ==
'.') {
1623 if (a + ext_len >= path_maxncpy) {
1627 memcpy(path + a, ext, ext_len + 1);
1635 const size_t filename_size = strlen(
filename) + 1;
1636 if (filename_size <= filepath_maxncpy - (c - filepath)) {
1637 memcpy(c,
filename, filename_size);
1645 const size_t dir_maxncpy,
1647 const size_t file_maxncpy)
1653 if (basename != filepath) {
1654 const size_t dir_size = (basename - filepath) + 1;
1655 BLI_strncpy(dir, filepath, std::min(dir_maxncpy, dir_size));
1667 if (basename != filepath) {
1668 const size_t dir_size = (basename - filepath) + 1;
1669 BLI_strncpy(dir, filepath, std::min(dir_maxncpy, dir_size));
1690 const char *ext =
nullptr;
1691 bool has_non_ext =
false;
1692 const char *c = filepath;
1704 has_non_ext =
false;
1723 return *ext ? ext :
nullptr;
1726size_t BLI_path_append(
char *__restrict dst,
const size_t dst_maxncpy,
const char *__restrict file)
1730 if (dst_len + 1 < dst_maxncpy) {
1737 const size_t dst_maxncpy,
1738 const char *__restrict dir)
1745 const size_t dst_maxncpy,
1746 const char *path_array[],
1747 const int path_array_num)
1752 if (dst_maxncpy == 0) [[unlikely]] {
1755 const char *path = path_array[0];
1757 const size_t dst_last = dst_maxncpy - 1;
1760 if (ofs == dst_last) {
1770 for (i = 0; i < ofs; i++) {
1771 if (dst[i] !=
'/') {
1777 return path_array_num > 1 ?
1779 dst + ofs, dst_maxncpy - ofs, &path_array[1], path_array_num - 1) :
1787 bool has_trailing_slash =
false;
1797 has_trailing_slash = (path[
len] !=
'\0');
1800 for (
int path_index = 1; path_index < path_array_num; path_index++) {
1801 path = path_array[path_index];
1802 has_trailing_slash =
false;
1807 size_t len = strlen(path);
1817 if (ofs == dst_last) {
1821 has_trailing_slash = (path[
len] !=
'\0');
1822 if (ofs +
len >= dst_last) {
1823 len = dst_last - ofs;
1825 memcpy(&dst[ofs], path,
len);
1827 if (ofs == dst_last) {
1833 has_trailing_slash = (
path_init != path);
1837 if (has_trailing_slash) {
1857 int *__restrict r_offset,
1858 int *__restrict r_len)
1865 const char c = path[i];
1867 if (prev + 1 != i) {
1870 if (!((i - prev == 1) && (prev != 0) && (path[prev] ==
'.'))) {
1871 if (index_step ==
index) {
1891 int *__restrict r_offset,
1892 int *__restrict r_len)
1896 int index_step = -1;
1897 int prev = strlen(path);
1900 const char c = i >= 0 ? path[i] :
'\0';
1902 if (prev - 1 != i) {
1905 if (!((prev - i == 1) && (i != 0) && (path[i] ==
'.'))) {
1906 if (index_step ==
index) {
1926 int *__restrict r_offset,
1927 int *__restrict r_len)
1935 if (container_path[0] ==
'\0') {
1939 const bool walk_up =
false;
1944 const char *base_dir,
1946 char *r_path_relative,
1947 const size_t r_path_relative_maxncpy)
1949 if (r_path_relative) {
1950 r_path_relative[0] =
'\0';
1953 if (base_dir[0] ==
'\0') {
1954 BLI_assert_msg(0,
"BLI_path_relative_to should not be called with an empty base directory");
1960 STRNCPY(base_dir_slash, base_dir);
1966 const bool blend_relative =
false;
1972 if (r_path_relative) {
1973 BLI_strncpy(r_path_relative, path_rel, r_path_relative_maxncpy);
1980 const char *
const ffslash = strchr(path,
'/');
1981 const char *
const fbslash = strchr(path,
'\\');
1990 return (ffslash < fbslash) ? ffslash : fbslash;
1995 const char *
const lfslash = strrchr(path,
'/');
1996 const char *
const lbslash = strrchr(path,
'\\');
2005 return (lfslash > lbslash) ? lfslash : lbslash;
2015 if (path_len + 1 < path_maxncpy) {
2016 path[path_len++] =
SEP;
2017 path[path_len] =
'\0';
2030 int len = strlen(path);
2033 path[
len - 1] =
'\0';
2074 char norm_p1_buf[256];
2075 char norm_p2_buf[256];
2077 const size_t p1_size = strlen(p1) + 1;
2078 const size_t p2_size = strlen(p2) + 1;
2080 char *norm_p1 = (p1_size <=
sizeof(norm_p1_buf)) ? norm_p1_buf :
2082 char *norm_p2 = (p2_size <=
sizeof(norm_p2_buf)) ? norm_p2_buf :
2085 memcpy(norm_p1, p1, p1_size);
2086 memcpy(norm_p2, p2, p2_size);
2100 if (norm_p1 != norm_p1_buf) {
2101 MEM_delete(norm_p1);
2103 if (norm_p2 != norm_p2_buf) {
2104 MEM_delete(norm_p2);
2111 bool component_start =
true;
2112 char cur_char = path[0];
2113 char prev_char =
'\0';
2115 while (cur_char !=
'\0') {
2116 char next_char = path[1];
2119 if (component_start && cur_char ==
'.') {
2120 if (!
ELEM(path[1],
'.',
'\0',
'/',
'\\')) {
2125 component_start =
ELEM(cur_char,
'/',
'\\');
2127 if (component_start && prev_char ==
'~') {
2132 prev_char = cur_char;
2133 cur_char = next_char;
2137 if (prev_char ==
'~') {
File and directory operations.
#define BLI_path_join(...)
#define STRNCPY_RLEN(dst, src)
#define SNPRINTF(dst, format,...)
#define BLI_string_debug_size_after_nil(str, str_maxncpy)
#define BLI_string_debug_size(str, str_maxncpy)
Compatibility-like things for windows.
Read Blender memory allocation and freeing.
#define BLI_assert_msg(a, msg)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
void free(Subdiv *subdiv)
std::string filename(const std::string_view &str, size_t pos)
bool bool BLI_path_extension_strip(char *path) ATTR_NONNULL(1)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
const char * BLI_path_parent_dir_end(const char *path, size_t path_len) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool void bool BLI_path_frame_check_chars(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_is_win32_drive_with_slash(const char *path)
const char * BLI_path_extension_or_end(const char *filepath) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
bool BLI_path_is_win32_drive(const char *path)
static int path_normalize_impl(char *path, bool check_blend_relative_prefix)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
void BLI_path_slash_forward_from_native(char *path) ATTR_NONNULL(1)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
static bool path_extension_check_ex(const char *path, const size_t path_len, const char *ext, const size_t ext_len)
static bool path_relative_to_impl(char *path, const size_t path_maxncpy, const char *basepath, const bool walk_up, const bool blend_relative)
bool BLI_path_make_safe(char *path) ATTR_NONNULL(1)
int BLI_path_normalize_dir(char *dir, size_t dir_maxncpy) ATTR_NONNULL(1)
bool BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_string_replace_char(char *str, char src, char dst) ATTR_NONNULL(1)
BLI_INLINE bool BLI_path_slash_is_native_compat(const char ch)
bool bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep) ATTR_NONNULL(1
size_t size_t BLI_path_append_dir(char *__restrict dst, size_t dst_maxncpy, const char *__restrict dir) ATTR_NONNULL(1
const char * BLI_path_extension(const char *filepath) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static bool ensure_digits(char *path, const size_t path_maxncpy, int digits)
bool BLI_path_frame(char *path, size_t path_maxncpy, int frame, int digits) ATTR_NONNULL(1)
size_t BLI_path_append(char *__restrict dst, size_t dst_maxncpy, const char *__restrict file) ATTR_NONNULL(1
static bool path_name_at_index_forward(const char *__restrict path, const int index, int *__restrict r_offset, int *__restrict r_len)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_file_stat_mode(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_path_frame_get(const char *path, int *r_frame, int *r_digits_len) ATTR_NONNULL(1
void BLI_path_slash_native(char *path) ATTR_NONNULL(1)
static bool path_name_at_index_backward(const char *__restrict path, const int index, int *__restrict r_offset, int *__restrict r_len)
void BLI_setenv(const char *env, const char *val) ATTR_NONNULL(1)
bool BLI_path_relative_to(const char *path, const char *base_dir, bool walk_up, char *r_path_relative, size_t r_path_relative_maxncpy) ATTR_NONNULL(1
bool BLI_path_frame_range(char *path, size_t path_maxncpy, int sta, int end, int digits) ATTR_NONNULL(1)
size_t BLI_string_replace_range(char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
static bool path_frame_chars_find_range(const char *path, int *r_char_start, int *r_char_end)
void BLI_path_slash_rstrip(char *path) ATTR_NONNULL(1)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
bool BLI_path_is_unc(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static int BLI_path_unc_prefix_len(const char *path)
int BLI_path_canonicalize_native(char *path, int path_maxncpy)
int BLI_str_utf8_invalid_substitute(char *str, size_t str_len, const char substitute) ATTR_NONNULL(1)
int BLI_path_cmp_normalized(const char *p1, const char *p2) ATTR_NONNULL(1
bool BLI_path_is_abs_from_cwd(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
int BLI_access(const char *filepath, int mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_path_program_search(char *program_filepath, size_t program_filepath_maxncpy, const char *program_name) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
bool BLI_path_abs_from_cwd(char *path, size_t path_maxncpy) ATTR_NONNULL(1)
constexpr size_t ARRAY_SIZE(const T(&arg)[N]) noexcept
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_path_extension_glob_validate(char *ext_fnmatch) ATTR_NONNULL(1)
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
bool BLI_path_is_win32_drive_only(const char *path)
ATTR_WARN_UNUSED_RESULT const size_t num
void BLI_setenv_if_new(const char *env, const char *val) ATTR_NONNULL(1)
int BLI_path_slash_ensure(char *path, size_t path_maxncpy) ATTR_NONNULL(1)
bool BLI_path_extension_replace(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
void BLI_str_tolower_ascii(char *str, size_t len) ATTR_NONNULL(1)
void BLI_path_to_display_name(char *display_name, int display_name_maxncpy, const char *name) ATTR_NONNULL(1
bool BLI_path_filename_ensure(char *filepath, size_t filepath_maxncpy, const char *filename) ATTR_NONNULL(1
int BLI_path_slash_ensure_ex(char *path, size_t path_maxncpy, const size_t path_len) ATTR_NONNULL(1)
bool BLI_path_name_at_index(const char *__restrict path, int index, int *__restrict r_offset, int *__restrict r_len) ATTR_NONNULL(1
bool BLI_path_parent_dir(char *path) ATTR_NONNULL(1)
void void void BLI_path_split_file_part(const char *filepath, char *file, size_t file_maxncpy) ATTR_NONNULL(1
bool BLI_path_extension_check_array(const char *path, const char **ext_array) ATTR_NONNULL(1
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
bool BLI_path_contains(const char *container_path, const char *containee_path) ATTR_NONNULL(1
int BLI_path_sequence_decode(const char *path, char *head, size_t head_maxncpy, char *tail, size_t tail_maxncpy, unsigned short *r_digits_len)
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
void BLI_path_sequence_encode(char *path, size_t path_maxncpy, const char *head, const char *tail, unsigned short numlen, int pic)
bool BLI_path_has_hidden_component(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
int BLI_path_normalize_native(char *path) ATTR_NONNULL(1)
bool BLI_path_extension_check_glob(const char *path, const char *ext_fnmatch) ATTR_NONNULL(1
bool void BLI_path_frame_strip(char *path, char *r_ext, size_t ext_maxncpy) ATTR_NONNULL(1
size_t BLI_path_join_array(char *__restrict dst, const size_t dst_maxncpy, const char *path_array[], const int path_array_num) ATTR_NONNULL(1
bool BLI_path_make_safe_filename(char *filename) ATTR_NONNULL(1)
const char * BLI_path_slash_find(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_parent_dir_until_exists(char *path) ATTR_NONNULL(1)
char * BLI_current_working_dir(char *dir, size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_path_extension_check_n(const char *path,...) ATTR_NONNULL(1) ATTR_SENTINEL(0)
const char * BLI_path_slash_rfind(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
const char * BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
bool BLI_path_make_safe_filename_ex(char *filename, bool allow_tokens) ATTR_NONNULL(1)
const char * BLI_path_slash_skip(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BLI_windows_get_default_root_dir(char root_dir[4])
void path_init(const string &path, const string &user_path)
#define FILENAME_FRAME_CHARS_MAX
int uputenv(const char *name, const char *value)
wchar_t * alloc_utf16_from_8(const char *in8, size_t add)
char * alloc_utf_8_from_16(const wchar_t *in16, size_t add)
int conv_utf_16_to_8(const wchar_t *in16, char *out8, size_t size8)