Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-03-13 23:48:07 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-03-13 23:48:07 +0400
commitdcbfa25bc8903fbffb563c6e0f5c89d94ea27ed3 (patch)
treedd5944eb1da4ac16d7a1c54de9c7ee39054e4f8b /source/blender/blenlib/intern/fileops.c
parent962865d19f4bd8639ac6c2064a3c82e5674e7802 (diff)
Fix #34551: blender crash rendering with save buffers.
Problem was the new usage of access() on Windows, this doesn't accept X_OK. Also wrapped _waccess so that UTF-8 paths work.
Diffstat (limited to 'source/blender/blenlib/intern/fileops.c')
-rw-r--r--source/blender/blenlib/intern/fileops.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c
index bda67e2eb74..29280c36222 100644
--- a/source/blender/blenlib/intern/fileops.c
+++ b/source/blender/blenlib/intern/fileops.c
@@ -167,7 +167,7 @@ char *BLI_file_ungzip_to_mem(const char *from_file, int *size_r)
bool BLI_file_is_writable(const char *filename)
{
bool writable;
- if (access(filename, W_OK) == 0) {
+ if (BLI_access(filename, W_OK) == 0) {
/* file exists and I can write to it */
writable = true;
}
@@ -179,7 +179,12 @@ bool BLI_file_is_writable(const char *filename)
/* file doesn't exist -- check I can create it in parent directory */
char parent[FILE_MAX];
BLI_split_dirfile(filename, parent, NULL, sizeof(parent), 0);
- writable = access(parent, X_OK | W_OK) == 0;
+#ifdef WIN32
+ /* windows does not have X_OK */
+ writable = BLI_access(parent, W_OK) == 0;
+#else
+ writable = BLI_access(parent, X_OK | W_OK) == 0;
+#endif
}
return writable;
}
@@ -258,6 +263,11 @@ int BLI_open(const char *filename, int oflag, int pmode)
return uopen(filename, oflag, pmode);
}
+int BLI_access(const char *filename, int mode)
+{
+ return uaccess(filename, mode);
+}
+
int BLI_delete(const char *file, bool dir, bool recursive)
{
int err;
@@ -597,6 +607,12 @@ int BLI_open(const char *filename, int oflag, int pmode)
return open(filename, oflag, pmode);
}
+int BLI_access(const char *filename, int mode)
+{
+ return access(filename, mode);
+}
+
+
/**
* Deletes the specified file or directory (depending on dir), optionally
* doing recursive delete of directory contents.