summaryrefslogtreecommitdiffstats
path: root/osdep/io.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-11 12:16:07 +0200
committerwm4 <wm4@nowhere>2017-04-11 12:19:41 +0200
commite0d93178b9f6006a9386878f924408dbff32dd29 (patch)
tree206d97474bad182f60bdf41e04fc7e704031f618 /osdep/io.c
parente2464b832bc90af4da552352466d73a465b7f855 (diff)
downloadmpv-e0d93178b9f6006a9386878f924408dbff32dd29.tar.bz2
mpv-e0d93178b9f6006a9386878f924408dbff32dd29.tar.xz
win32: add UTF-8 getcwd() wrapper
Diffstat (limited to 'osdep/io.c')
-rw-r--r--osdep/io.c18
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