diff --git a/shaders/shader_platform.h b/shaders/shader_platform.h index 2c2f004d..e9a1b180 100644 --- a/shaders/shader_platform.h +++ b/shaders/shader_platform.h @@ -14,10 +14,13 @@ #include "gl_core_3_1.h" #include +#ifdef UNICODE +#define chdir(dir) _wchdir(Utf8ToWide(dir)) +#define realpath(src, resolved) _twfullpath(resolved, src, PATH_MAX) +#else #define chdir(dir) _chdir(dir) #define realpath(src, resolved) _fullpath(resolved, src, PATH_MAX) - - +#endif #endif diff --git a/win32/_tfwopen.cpp b/win32/_tfwopen.cpp index 345cf7be..dbd703ac 100644 --- a/win32/_tfwopen.cpp +++ b/win32/_tfwopen.cpp @@ -229,4 +229,11 @@ extern "C" int _twopen(const char *filename, int oflag, int pmode) { return _wopen(Utf8ToWide(filename), oflag, pmode); } +extern "C" void _twfullpath(char* dst, const char* src, int len) { + wchar_t *resolved = _wfullpath(NULL, Utf8ToWide(src), MAX_PATH); + strncpy(dst, WideToUtf8(resolved), len); + dst[len - 1] = '\0'; + return; +} + #endif // UNICODE diff --git a/win32/_tfwopen.h b/win32/_tfwopen.h index f7d5763b..c8a5cb90 100644 --- a/win32/_tfwopen.h +++ b/win32/_tfwopen.h @@ -198,6 +198,7 @@ extern "C" { FILE *_tfwopen(const char *filename, const char *mode ); int _twremove(const char *filename ); int _twopen(const char *filename, int oflag, int pmode); +void _twfullpath(char* dst, const char* src, int len); #ifdef __cplusplus }