Fix #35824: finding missing files not working correct for filepaths with special
characters on Windows. Replaced some uses of stat() by BLI_stat() to properly handle such filepaths.
This commit is contained in:
@@ -235,7 +235,7 @@ static int findFileRecursive(char *filename_new,
|
||||
|
||||
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
|
||||
|
||||
if (stat(path, &status) != 0)
|
||||
if (BLI_stat(path, &status) != 0)
|
||||
continue; /* cant stat, don't bother with this file, could print debug info here */
|
||||
|
||||
if (S_ISREG(status.st_mode)) { /* is file */
|
||||
|
||||
@@ -378,7 +378,7 @@ int checkPackedFile(const char *filename, PackedFile *pf)
|
||||
BLI_strncpy(name, filename, sizeof(name));
|
||||
BLI_path_abs(name, G.main->name);
|
||||
|
||||
if (stat(name, &st)) {
|
||||
if (BLI_stat(name, &st)) {
|
||||
ret_val = PF_NOFILE;
|
||||
}
|
||||
else if (st.st_size != pf->size) {
|
||||
|
||||
@@ -251,7 +251,7 @@ void *BLI_gzopen(const char *filename, const char *mode)
|
||||
fclose(ufopen(filename, "a"));
|
||||
|
||||
/* temporary #if until we update all libraries to 1.2.7
|
||||
* for correct wide char path handling */
|
||||
* for correct wide char path handling */
|
||||
#if ZLIB_VERNUM >= 0x1270 && !defined(FREE_WINDOWS)
|
||||
UTF16_ENCODE(filename);
|
||||
|
||||
|
||||
@@ -667,7 +667,7 @@ bool autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v))
|
||||
|
||||
BLI_join_dirfile(path, sizeof(path), dirname, de->d_name);
|
||||
|
||||
if (stat(path, &status) == 0) {
|
||||
if (BLI_stat(path, &status) == 0) {
|
||||
if (S_ISDIR(status.st_mode)) { /* is subdir */
|
||||
autocomplete_do_name(autocpl, path);
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ static void txt_write_file(Text *text, ReportList *reports)
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if (stat(filepath, &st) == 0) {
|
||||
if (BLI_stat(filepath, &st) == 0) {
|
||||
text->mtime = st.st_mtime;
|
||||
}
|
||||
else {
|
||||
@@ -3107,7 +3107,7 @@ int text_file_modified(Text *text)
|
||||
if (!BLI_exists(file))
|
||||
return 2;
|
||||
|
||||
result = stat(file, &st);
|
||||
result = BLI_stat(file, &st);
|
||||
|
||||
if (result == -1)
|
||||
return -1;
|
||||
@@ -3134,7 +3134,7 @@ static void text_ignore_modified(Text *text)
|
||||
|
||||
if (!BLI_exists(file)) return;
|
||||
|
||||
result = stat(file, &st);
|
||||
result = BLI_stat(file, &st);
|
||||
|
||||
if (result == -1 || (st.st_mode & S_IFMT) != S_IFREG)
|
||||
return;
|
||||
|
||||
@@ -319,7 +319,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
|
||||
}
|
||||
|
||||
if (img != NULL) {
|
||||
stat(path, &info);
|
||||
BLI_stat(path, &info);
|
||||
BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime);
|
||||
BLI_snprintf(cwidth, sizeof(cwidth), "%d", img->x);
|
||||
BLI_snprintf(cheight, sizeof(cheight), "%d", img->y);
|
||||
@@ -339,7 +339,7 @@ ImBuf *IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, Im
|
||||
}
|
||||
IMB_free_anim(anim);
|
||||
}
|
||||
stat(path, &info);
|
||||
BLI_stat(path, &info);
|
||||
BLI_snprintf(mtime, sizeof(mtime), "%ld", (long int)info.st_mtime);
|
||||
}
|
||||
if (!img) return NULL;
|
||||
|
||||
@@ -164,7 +164,7 @@ static int IMB_ispic_name(const char *name)
|
||||
|
||||
if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
|
||||
|
||||
if (stat(name, &st) == -1)
|
||||
if (BLI_stat(name, &st) == -1)
|
||||
return FALSE;
|
||||
if (((st.st_mode) & S_IFMT) != S_IFREG)
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user