30# define _WIN32_IE 0x0501
46static bool BLI_path_is_abs_win32(
const char *path);
47static int BLI_path_win32_prefix_len(
const char *path);
56#define FILENAME_FRAME_CHARS_MAX FILE_MAX
60 const size_t head_maxncpy,
62 const size_t tail_maxncpy,
72 uint nums = 0, nume = 0;
74 bool found_digit =
false;
77 const uint lslash_len = lslash !=
nullptr ? int(lslash - path) : 0;
78 const uint name_end =
uint(extension - path);
80 for (
i = name_end - 1;
i >= int(lslash_len);
i--) {
81 if (isdigit(path[
i])) {
99 const long long int ret = strtoll(&(path[nums]),
nullptr, 10);
100 if (
ret >= INT_MIN &&
ret <= INT_MAX) {
105 BLI_strncpy(head, path, std::min<size_t>(head_maxncpy, nums + 1));
108 *r_digits_len = nume - nums + 1;
120 BLI_strncpy(head, path, std::min<size_t>(head_maxncpy, name_end + 1));
129 const size_t path_maxncpy,
143 BLI_snprintf(path, path_maxncpy,
"%s%.*d%s", head, numlen, std::max(0, pic), tail);
152 const char *path_orig = path;
153 int path_len = strlen(path);
159 if (check_blend_relative_prefix && (path[0] ==
'/' && path[1] ==
'/')) {
166 while (path[
i] ==
SEP) {
171 memmove(path, path +
i, (path_len -
i) + 1);
180 if (path_orig == path) {
185 path += path_unc_len;
186 path_len -= path_unc_len;
195 const bool is_relative = path[0] && (path[0] !=
SEP);
214 for (
int i = path_len - 1;
i > 0;
i--) {
216 if (path[
i] ==
SEP) {
221 if (path[
i - 1] ==
SEP) {
224 else if (
i >= 2 && path[
i - 1] ==
'.' && path[
i - 2] ==
SEP) {
233 memmove(path +
i, path + i_end, (path_len - i_end) + 1);
234 path_len -= i_end -
i;
242 if ((path_len > 2) && (path[0] ==
'.') && (path[1] ==
SEP)) {
243 memmove(path, path + 2, (path_len - 2) + 1);
259#define IS_PARENT_DIR(p) ((p)[0] == '.' && (p)[1] == '.' && ELEM((p)[2], SEP, '\0'))
262 char *path_first_non_slash_part = path;
263 while (*path_first_non_slash_part && *path_first_non_slash_part ==
SEP) {
264 path_first_non_slash_part++;
269 char *start_base = path_first_non_slash_part;
276 if (start_base < path + path_len) {
278 char *start = start_base;
282 (start_temp = ((start <= &path[path_len - 3]) &&
284 &path[path_len - 3] :
287 start = start_temp + 1;
291 char *end_all = start;
306 }
while (start_base < start && *(start - 1) !=
SEP);
310 }
while ((start != start_base) && (end < end_all));
312 if (end > path + path_len) {
317 BLI_assert(start < end && start >= start_base);
318 const size_t start_len = path_len - (end - path);
319 memmove(start, end, start_len + 1);
320 path_len -= end - start;
323 if (
UNLIKELY(start == start_base && (end != end_all))) {
324 start_base += (end_all - end);
325 start = (start_base < path + path_len) ? start_base : start_base - 1;
332 BLI_assert((start_base - path_first_non_slash_part) % 3 == 0);
336 !(path_len >= 3 &&
STREQ(&path[path_len - 3],
SEP_STR ".."))));
343 if (path_len == 0 && (path == path_orig)) {
354 if (start_base != path_first_non_slash_part) {
355 char *start = start_base > path + path_len ? start_base - 1 : start_base;
359 const size_t start_len = path_len - (start - path);
361 memmove(path_first_non_slash_part, start, start_len + 1);
362 path_len -= start - path_first_non_slash_part;
371 return (path - path_orig) + path_len;
387 if (dir[0] ==
'\0') {
405 if (path_len > 1 && path[path_len - 1] ==
SEP) {
408 if (BLI_path_win32_prefix_len(path) + 1 < path_len)
412 path[path_len] =
'\0';
420#define INVALID_CHARS \
421 "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \
422 "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \
424#define INVALID_TOKENS "<>"
432 bool changed =
false;
434 if (*filename ==
'\0') {
438 for (fn = filename; *fn && (fn = strpbrk(fn, invalid)); fn++) {
444 for (fn = filename; *fn ==
'.'; fn++) {
454 const char *invalid_names[] = {
455 "con",
"prn",
"aux",
"null",
"com1",
"com2",
"com3",
"com4",
456 "com5",
"com6",
"com7",
"com8",
"com9",
"lpt1",
"lpt2",
"lpt3",
457 "lpt4",
"lpt5",
"lpt6",
"lpt7",
"lpt8",
"lpt9",
nullptr,
459 const size_t len = strlen(filename);
464 if (filename[
len - 1] ==
'.') {
465 filename[
len - 1] =
'_';
473 for (iname = invalid_names; *iname; iname++) {
474 if (strstr(filename_lower, *iname) == filename_lower) {
475 const size_t iname_len = strlen(*iname);
479 if ((iname_len ==
len) || (filename_lower[iname_len] ==
'.')) {
503 char *curr_slash, *curr_path = path;
504 bool changed =
false;
505 bool skip_first =
false;
508 if (BLI_path_is_abs_win32(path)) {
517 const char backup = *curr_slash;
523 curr_path = curr_slash + 1;
524 *curr_slash = backup;
535 return path[0] ==
'/' && path[1] ==
'/';
540 return path[0] ==
'\\' && path[1] ==
'\\';
552 if ((path[2] ==
'?') && (path[3] ==
'\\')) {
564static int BLI_path_win32_prefix_len(
const char *path)
575 return isalpha(path[0]) && (path[1] ==
':');
580 return isalpha(path[0]) && (path[1] ==
':') && (path[2] ==
'\0');
585 return isalpha(path[0]) && (path[1] ==
':') &&
ELEM(path[2],
'\\',
'/');
598static bool BLI_path_is_abs_win32(
const char *path)
605static wchar_t *next_slash(
wchar_t *path)
607 wchar_t *slash = path;
608 while (*slash && *slash !=
L'\\') {
615static void BLI_path_add_slash_to_share(
wchar_t *uncpath)
617 wchar_t *slash_after_server = next_slash(uncpath + 2);
618 if (*slash_after_server) {
619 wchar_t *slash_after_share = next_slash(slash_after_server + 1);
620 if (!(*slash_after_share)) {
621 slash_after_share[0] =
L'\\';
622 slash_after_share[1] =
L'\0';
627static void BLI_path_unc_to_short(
wchar_t *unc)
631 int len = wcslen(unc);
637 if ((
len > 3) && (unc[0] ==
L'\\') && (unc[1] ==
L'\\') && (unc[2] ==
L'?') &&
638 ELEM(unc[3],
L'\\',
L'/'))
640 if ((
len > 5) && (unc[5] ==
L':')) {
641 wcsncpy(tmp, unc + 4,
len - 4);
642 tmp[
len - 4] =
L'\0';
645 else if ((
len > 7) && (wcsncmp(&unc[4],
L"UNC", 3) == 0) &&
ELEM(unc[7],
L'\\',
L'/')) {
648 wcsncpy(tmp + 2, unc + 8,
len - 8);
649 tmp[
len - 6] =
L'\0';
655void BLI_path_normalize_unc(
char *path,
int path_maxncpy)
658 BLI_path_normalize_unc_16(tmp_16);
662void BLI_path_normalize_unc_16(
wchar_t *path_16)
664 BLI_path_unc_to_short(path_16);
665 BLI_path_add_slash_to_share(path_16);
684 if (basepath[0] ==
'\0') {
689 if (
BLI_strnlen(basepath, 3) > 2 && !BLI_path_is_abs_win32(basepath)) {
695 if (!
ELEM(basepath[0],
'\\',
'/')) {
716 for (off = 0; temp[off] && slash < 4; off++) {
717 if (temp[off] != path[off]) {
721 if (temp[off] ==
'\\') {
726 else if ((temp[1] ==
':' && path[1] ==
':') && (tolower(temp[0]) != tolower(path[0]))) {
747 const char *p = temp;
748 const char *q = path;
751 while (tolower(*p) == tolower(*q))
760 if ((*p ==
'\0') || (*q ==
'\0')) {
768 while ((q >= path) && (*q !=
'/')) {
773 else if (*p !=
'/') {
774 while ((p >= temp) && (*p !=
'/')) {
790 while (p && p < lslash) {
808bool BLI_path_suffix(
char *path,
size_t path_maxncpy,
const char *suffix,
const char *sep)
812 const size_t suffix_len = strlen(suffix);
813 const size_t sep_len = strlen(sep);
815 const size_t extension_len = strlen(extension);
816 const size_t path_end = extension - path;
817 const size_t path_len = path_end + extension_len;
818 if (path_len + sep_len + suffix_len >= path_maxncpy) {
823 memmove(extension + (sep_len + suffix_len), extension, extension_len);
825 char *c = path + path_end;
827 memcpy(c, sep, sep_len);
831 memcpy(c, suffix, suffix_len);
841 const char *path_end = path + path_len - 1;
842 const char *p = path_end;
860 if ((p > path) && (p != path_end)) {
874 int tail_ofs = 0, tail_len = 0;
881 if (path[tail_ofs] ==
'.') {
887 BLI_assert(!((tail_len == 2) && (path[tail_ofs] ==
'.') && (path[tail_ofs + 1] ==
'.')));
888 path[tail_ofs] =
'\0';
894 bool valid_path =
true;
900 return (valid_path && path[0]);
915 uint ch_sta, ch_end,
i;
918 for (
i = 0; path[
i] !=
'\0';
i++) {
919 if (
ELEM(path[
i],
'\\',
'/')) {
922 else if (path[
i] ==
'#') {
925 while (path[ch_end] ==
'#') {
935 *r_char_start = ch_sta;
936 *r_char_end = ch_end;
952 if (strrchr(file,
'#') ==
nullptr) {
953 int len = strlen(file);
975 SNPRINTF(frame_str,
"%.*d", ch_span, frame);
995 SNPRINTF(frame_str,
"%.*d-%.*d", ch_span, sta, ch_span, end);
1004 if (*path ==
'\0') {
1012 const char *c = file_ext;
1016 while (c-- != file && isdigit(*c)) {
1021 if (digits_len == 0) {
1027 *r_digits_len = digits_len;
1035 if (*path ==
'\0') {
1045 while (c-- != file && isdigit(*c)) {
1053 while (digits_len--) {
1061 int ch_sta_dummy, ch_end_dummy;
1070 int strip_offset = 0;
1071 while (
ELEM(
name[strip_offset],
'_',
' ')) {
1075 int display_name_len =
BLI_strncpy_rlen(display_name,
name + strip_offset, display_name_maxncpy);
1088 bool all_lower =
true;
1089 for (
int i = 0; display_name[
i];
i++) {
1090 if (isupper(display_name[
i])) {
1098 bool prevspace =
true;
1099 for (
int i = 0; display_name[
i];
i++) {
1101 display_name[
i] = toupper(display_name[
i]);
1104 prevspace = isspace(display_name[
i]);
1121 if (*path ==
'\0') {
1127 if (!wasrelative && !BLI_path_is_abs_win32(path)) {
1128 const size_t root_dir_len = 3;
1135 BLI_strncpy(tmp + root_dir_len, p,
sizeof(tmp) - root_dir_len);
1151 tmp[1] = tolower(tmp[0]);
1182 const int baselen = int(lslash - base) + 1;
1186 memcpy(tmp, base, baselen);
1187 BLI_strncpy(tmp + baselen, path,
sizeof(tmp) - baselen);
1215 bool is_abs =
false;
1218 if (BLI_path_is_abs_win32(path)) {
1222 if (path[0] ==
'/') {
1242 printf(
"Could not get the current working directory - $PWD for an unknown reason.\n");
1256bool BLI_path_program_extensions_add_win32(
char *program_name,
const size_t program_name_maxncpy)
1258 bool retval =
false;
1262 if ((type == 0) ||
S_ISDIR(type)) {
1264 const int ext_max = 12;
1267 const int program_name_len = strlen(program_name);
1268 char *filename =
static_cast<char *
>(alloca(program_name_len + ext_max));
1270 const char *ext_next;
1273 memcpy(filename, program_name, program_name_len);
1274 filename_ext = filename + program_name_len;
1278 ext_next = strchr(ext,
';');
1279 ext_len = ext_next ? ((ext_next++) - ext) : strlen(ext);
1281 if (
LIKELY(ext_len < ext_max)) {
1282 memcpy(filename_ext, ext, ext_len);
1283 filename_ext[ext_len] =
'\0';
1286 if (type && (!
S_ISDIR(type))) {
1288 BLI_strncpy(program_name, filename, program_name_maxncpy);
1292 }
while ((ext = ext_next));
1304 const size_t program_filepath_maxncpy,
1305 const char *program_name)
1310 bool retval =
false;
1313 const char separator =
';';
1315 const char separator =
':';
1324 temp = strchr(path, separator);
1326 memcpy(filepath_test, path, temp - path);
1327 filepath_test[temp - path] = 0;
1334 BLI_path_append(filepath_test, program_filepath_maxncpy, program_name);
1337 BLI_path_program_extensions_add_win32(filepath_test,
sizeof(filepath_test))
1350 if (retval ==
false) {
1359#if (defined(_WIN32) || defined(_WIN64))
1365 setenv(env, val, 1);
1383 const char *
result =
nullptr;
1386 static wchar_t buffer[32768];
1389 if (GetEnvironmentVariableW(env_16, buffer,
ARRAY_SIZE(buffer))) {
1393 if (strlen(res_utf8) + 1 <
sizeof(buffer)) {
1396 memcpy(buffer, res_utf8, strlen(res_utf8) + 1);
1397 result = (
const char *)buffer;
1410 const size_t path_len,
1412 const size_t ext_len)
1417 return (((path_len == 0 || ext_len == 0 || ext_len >= path_len) == 0) &&
1428 const size_t path_len = strlen(path);
1434 va_start(args, path);
1436 while ((ext = (
const char *)va_arg(args,
void *))) {
1450 const size_t path_len = strlen(path);
1453 while (ext_array[
i]) {
1465 const char *ext_step = ext_fnmatch;
1468 while (ext_step[0]) {
1469 const char *ext_next;
1472 if ((ext_next = strchr(ext_step,
';'))) {
1473 len_ext = ext_next - ext_step + 1;
1474 BLI_strncpy(pattern, ext_step, (len_ext >
sizeof(pattern)) ?
sizeof(pattern) : len_ext);
1480 if (fnmatch(pattern, path, FNM_CASEFOLD) == 0) {
1483 ext_step += len_ext;
1491 bool only_wildcards =
false;
1493 for (
size_t i = strlen(ext_fnmatch);
i-- > 0;) {
1494 if (ext_fnmatch[
i] ==
';') {
1497 if (only_wildcards) {
1498 ext_fnmatch[
i] =
'\0';
1503 if (!
ELEM(ext_fnmatch[
i],
'?',
'*')) {
1508 only_wildcards =
true;
1520 const size_t ext_len = strlen(ext);
1521 if ((path_ext - path) + ext_len >= path_maxncpy) {
1525 memcpy(path_ext, ext, ext_len + 1);
1532 if (path_ext ==
nullptr) {
1546 if (
STREQ(path_ext, ext)) {
1550 const size_t path_len = strlen(path);
1551 const size_t ext_len = strlen(ext);
1554 for (a = path_len - 1; a >= 0; a--) {
1555 if (path[a] ==
'.') {
1564 if (a + ext_len >= path_maxncpy) {
1568 memcpy(path + a, ext, ext_len + 1);
1576 const size_t filename_size = strlen(filename) + 1;
1577 if (filename_size <= filepath_maxncpy - (c - filepath)) {
1578 memcpy(c, filename, filename_size);
1586 const size_t dir_maxncpy,
1588 const size_t file_maxncpy)
1594 if (basename != filepath) {
1595 const size_t dir_size = (basename - filepath) + 1;
1596 BLI_strncpy(dir, filepath, std::min(dir_maxncpy, dir_size));
1608 if (basename != filepath) {
1609 const size_t dir_size = (basename - filepath) + 1;
1610 BLI_strncpy(dir, filepath, std::min(dir_maxncpy, dir_size));
1631 const char *ext =
nullptr;
1632 bool has_non_ext =
false;
1633 const char *c = filepath;
1645 has_non_ext =
false;
1664 return *ext ? ext :
nullptr;
1667size_t BLI_path_append(
char *__restrict dst,
const size_t dst_maxncpy,
const char *__restrict file)
1671 if (dst_len + 1 < dst_maxncpy) {
1678 const size_t dst_maxncpy,
1679 const char *__restrict dir)
1686 const size_t dst_maxncpy,
1687 const char *path_array[],
1688 const int path_array_num)
1696 const char *path = path_array[0];
1698 const size_t dst_last = dst_maxncpy - 1;
1701 if (ofs == dst_last) {
1711 for (
i = 0;
i < ofs;
i++) {
1712 if (dst[
i] !=
'/') {
1718 return path_array_num > 1 ?
1720 dst + ofs, dst_maxncpy - ofs, &path_array[1], path_array_num - 1) :
1728 bool has_trailing_slash =
false;
1738 has_trailing_slash = (path[
len] !=
'\0');
1741 for (
int path_index = 1; path_index < path_array_num; path_index++) {
1742 path = path_array[path_index];
1743 has_trailing_slash =
false;
1748 size_t len = strlen(path);
1758 if (ofs == dst_last) {
1762 has_trailing_slash = (path[
len] !=
'\0');
1763 if (ofs +
len >= dst_last) {
1764 len = dst_last - ofs;
1766 memcpy(&dst[ofs], path,
len);
1768 if (ofs == dst_last) {
1774 has_trailing_slash = (
path_init != path);
1778 if (has_trailing_slash) {
1793 return filename ? filename + 1 : path;
1798 int *__restrict r_offset,
1799 int *__restrict r_len)
1806 const char c = path[
i];
1808 if (prev + 1 !=
i) {
1811 if (!((
i - prev == 1) && (prev != 0) && (path[prev] ==
'.'))) {
1812 if (index_step == index) {
1832 int *__restrict r_offset,
1833 int *__restrict r_len)
1837 int index_step = -1;
1838 int prev = strlen(path);
1841 const char c =
i >= 0 ? path[
i] :
'\0';
1843 if (prev - 1 !=
i) {
1846 if (!((prev -
i == 1) && (
i != 0) && (path[
i] ==
'.'))) {
1847 if (index_step == index) {
1867 int *__restrict r_offset,
1868 int *__restrict r_len)
1882 STRNCPY(containee_native, containee_path);
1895 if (
STREQ(container_native, containee_native)) {
1909 const char *
const ffslash = strchr(path,
'/');
1910 const char *
const fbslash = strchr(path,
'\\');
1919 return (ffslash < fbslash) ? ffslash : fbslash;
1924 const char *
const lfslash = strrchr(path,
'/');
1925 const char *
const lbslash = strrchr(path,
'\\');
1934 return (lfslash > lbslash) ? lfslash : lbslash;
1944 if (path_len + 1 < path_maxncpy) {
1945 path[path_len++] =
SEP;
1946 path[path_len] =
'\0';
1959 int len = strlen(path);
1962 path[
len - 1] =
'\0';
1996 char norm_p1_buf[256];
1997 char norm_p2_buf[256];
1999 const size_t p1_size = strlen(p1) + 1;
2000 const size_t p2_size = strlen(p2) + 1;
2002 char *norm_p1 = (p1_size <=
sizeof(norm_p1_buf)) ? norm_p1_buf :
2004 char *norm_p2 = (p2_size <=
sizeof(norm_p2_buf)) ? norm_p2_buf :
2007 memcpy(norm_p1, p1, p1_size);
2008 memcpy(norm_p2, p2, p2_size);
2022 if (norm_p1 != norm_p1_buf) {
2025 if (norm_p2 != norm_p2_buf) {
2033 bool component_start =
true;
2034 char cur_char = path[0];
2035 char prev_char =
'\0';
2037 while (cur_char !=
'\0') {
2038 char next_char = path[1];
2041 if (component_start && cur_char ==
'.') {
2042 if (!
ELEM(path[1],
'.',
'\0',
'/',
'\\')) {
2047 component_start =
ELEM(cur_char,
'/',
'\\');
2049 if (component_start && prev_char ==
'~') {
2054 prev_char = cur_char;
2055 cur_char = next_char;
2059 if (prev_char ==
'~') {
#define BLI_assert_msg(a, msg)
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_current_working_dir(char *dir, size_t maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_access(const char *filepath, int mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_kdtree_nd_ free(KDTree *tree)
#define BLI_path_join(...)
BLI_INLINE bool BLI_path_slash_is_native_compat(const char ch)
int bool BLI_str_startswith(const char *__restrict str, const char *__restrict start) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
#define STRNCPY_RLEN(dst, src)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define SNPRINTF(dst, format,...)
int char char int int int int size_t BLI_strnlen(const char *str, size_t maxlen) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define BLI_string_debug_size_after_nil(str, str_maxncpy)
#define BLI_string_debug_size(str, str_maxncpy)
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
char * STRNCPY(char(&dst)[N], const char *src)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void BLI_str_tolower_ascii(char *str, size_t len) 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
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
int BLI_str_utf8_invalid_substitute(char *str, size_t str_len, const char substitute) ATTR_NONNULL(1)
void BLI_string_replace_char(char *str, char src, char dst) ATTR_NONNULL(1)
size_t BLI_string_replace_range(char *string, size_t string_maxncpy, int src_beg, int src_end, const char *dst)
Compatibility-like things for windows.
void BLI_windows_get_default_root_dir(char root_dir[4])
Read Guarded memory(de)allocation.
char program_filepath[FILE_MAX]
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void path_init(const string &path, const string &user_path)
bool BLI_path_extension_check(const char *path, const char *ext)
size_t BLI_path_join_array(char *__restrict dst, const size_t dst_maxncpy, const char *path_array[], const int path_array_num)
bool BLI_path_is_unc(const char *path)
void BLI_path_slash_rstrip(char *path)
bool BLI_path_make_safe(char *path)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath)
void BLI_path_split_dir_part(const char *filepath, char *dir, const size_t dir_maxncpy)
void BLI_path_sequence_encode(char *path, const size_t path_maxncpy, const char *head, const char *tail, ushort numlen, int pic)
const char * BLI_path_parent_dir_end(const char *path, size_t path_len)
void BLI_path_slash_native(char *path)
void BLI_path_frame_strip(char *path, char *r_ext, const size_t ext_maxncpy)
bool BLI_path_parent_dir(char *path)
bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep)
static bool path_name_at_index_forward(const char *__restrict path, const int index, int *__restrict r_offset, int *__restrict r_len)
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext)
bool BLI_path_is_abs_from_cwd(const char *path)
const char * BLI_path_slash_skip(const char *path)
static bool path_frame_chars_find_range(const char *path, int *r_char_start, int *r_char_end)
const char * BLI_getenv(const char *env)
bool BLI_path_extension_check_array(const char *path, const char **ext_array)
int BLI_path_cmp_normalized(const char *p1, const char *p2)
static int path_normalize_impl(char *path, bool check_blend_relative_prefix)
bool BLI_path_is_win32_drive(const char *path)
size_t BLI_path_append_dir(char *__restrict dst, const size_t dst_maxncpy, const char *__restrict dir)
bool BLI_path_extension_strip(char *path)
#define FILENAME_FRAME_CHARS_MAX
int BLI_path_sequence_decode(const char *path, char *head, const size_t head_maxncpy, char *tail, const size_t tail_maxncpy, ushort *r_digits_len)
bool BLI_path_contains(const char *container_path, const char *containee_path)
bool BLI_path_extension_replace(char *path, size_t path_maxncpy, const char *ext)
bool BLI_path_parent_dir_until_exists(char *path)
int BLI_path_canonicalize_native(char *path, int path_maxncpy)
const char * BLI_path_extension_or_end(const char *filepath)
static bool path_extension_check_ex(const char *path, const size_t path_len, const char *ext, const size_t ext_len)
size_t BLI_path_append(char *__restrict dst, const size_t dst_maxncpy, const char *__restrict file)
bool BLI_path_abs_from_cwd(char *path, const size_t path_maxncpy)
const char * BLI_path_slash_find(const char *path)
bool BLI_path_frame_check_chars(const char *path)
bool BLI_path_make_safe_filename_ex(char *filename, bool allow_tokens)
int BLI_path_slash_ensure(char *path, size_t path_maxncpy)
bool BLI_path_extension_glob_validate(char *ext_fnmatch)
bool BLI_path_extension_check_glob(const char *path, const char *ext_fnmatch)
const char * BLI_path_extension(const char *filepath)
static void ensure_digits(char *path, int digits)
bool BLI_path_is_rel(const char *path)
static int BLI_path_unc_prefix_len(const char *path)
void BLI_path_rel(char path[FILE_MAX], const char *basepath)
void BLI_path_split_dir_file(const char *filepath, char *dir, const size_t dir_maxncpy, char *file, const size_t file_maxncpy)
bool BLI_path_filename_ensure(char *filepath, size_t filepath_maxncpy, const char *filename)
int BLI_path_slash_ensure_ex(char *path, size_t path_maxncpy, size_t path_len)
bool BLI_path_is_win32_drive_only(const char *path)
int BLI_path_normalize_native(char *path)
void BLI_path_split_file_part(const char *filepath, char *file, const size_t file_maxncpy)
void BLI_setenv(const char *env, const char *val)
void BLI_path_to_display_name(char *display_name, int display_name_maxncpy, const char *name)
void BLI_setenv_if_new(const char *env, const char *val)
bool BLI_path_make_safe_filename(char *filename)
bool BLI_path_is_win32_drive_with_slash(const char *path)
bool BLI_path_program_search(char *program_filepath, const size_t program_filepath_maxncpy, const char *program_name)
static bool path_name_at_index_backward(const char *__restrict path, const int index, int *__restrict r_offset, int *__restrict r_len)
bool BLI_path_has_hidden_component(const char *path)
bool BLI_path_frame(char *path, size_t path_maxncpy, int frame, int digits)
bool BLI_path_name_at_index(const char *__restrict path, const int index, int *__restrict r_offset, int *__restrict r_len)
int BLI_path_normalize(char *path)
bool BLI_path_frame_range(char *path, size_t path_maxncpy, int sta, int end, int digits)
const char * BLI_path_slash_rfind(const char *path)
bool BLI_path_extension_check_n(const char *path,...)
bool BLI_path_frame_get(const char *path, int *r_frame, int *r_digits_len)
int BLI_path_normalize_dir(char *dir, size_t dir_maxncpy)
const char * BLI_path_basename(const char *path)
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)