diff options
Diffstat (limited to 'source/blender/blenlib/intern/storage.c')
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 64b8ff40bcf..b34a9c0a44e 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -52,7 +52,9 @@ #ifdef WIN32 # include <io.h> # include <direct.h> +# include <stdbool.h> # include "BLI_winstuff.h" +# include "BLI_string_utf8.h" # include "utfconv.h" #else # include <sys/ioctl.h> @@ -77,6 +79,15 @@ */ char *BLI_current_working_dir(char *dir, const size_t maxncpy) { +#if defined(WIN32) + wchar_t path[MAX_PATH]; + if (_wgetcwd(path, MAX_PATH)) { + if (BLI_strncpy_wchar_as_utf8(dir, path, maxncpy) != maxncpy) { + return dir; + } + } + return NULL; +#else const char *pwd = BLI_getenv("PWD"); if (pwd) { size_t srclen = BLI_strnlen(pwd, maxncpy); @@ -88,8 +99,8 @@ char *BLI_current_working_dir(char *dir, const size_t maxncpy) return NULL; } } - return getcwd(dir, maxncpy); +#endif } /** |