diff options
Diffstat (limited to 'osdep/io.c')
-rw-r--r-- | osdep/io.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/osdep/io.c b/osdep/io.c index 26889189cf..1e1bf19ccf 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -335,6 +335,24 @@ int mp_mkdir(const char *path, int mode) return res; } +char *mp_win32_getcwd(char *buf, size_t size) +{ + wchar_t *wres = _wgetcwd(NULL, 0); + if (!wres) + return NULL; + char *t = mp_to_utf8(NULL, wres); + free(wres); + size_t st = strlen(t); + if (st >= size) { + talloc_free(t); + errno = ERANGE; + return NULL; + } + memcpy(buf, t, st + 1); + talloc_free(t); + return buf; +} + FILE *mp_tmpfile(void) { // Reserve a file name in the format %TMP%\mpvXXXX.TMP |