diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:13:14 +0000 |
commit | 60e8a3d404f0640fa5a3f834eae54b4f1fb9127d (patch) | |
tree | 1da89a218d0ecf010c67a87cb2f625c4cb18e7d7 /osdep/path-uwp.c | |
parent | Adding upstream version 0.37.0. (diff) | |
download | mpv-upstream/0.38.0.tar.xz mpv-upstream/0.38.0.zip |
Adding upstream version 0.38.0.upstream/0.38.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | osdep/path-uwp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/osdep/path-uwp.c b/osdep/path-uwp.c index 7eafb03..e21c9d1 100644 --- a/osdep/path-uwp.c +++ b/osdep/path-uwp.c @@ -27,9 +27,13 @@ WINBASEAPI DWORD WINAPI GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffe const char *mp_get_platform_path_uwp(void *talloc_ctx, const char *type) { if (strcmp(type, "home") == 0) { - wchar_t homeDir[_MAX_PATH]; - if (GetCurrentDirectoryW(_MAX_PATH, homeDir) != 0) - return mp_to_utf8(talloc_ctx, homeDir); + DWORD count = GetCurrentDirectoryW(0, NULL); + wchar_t *home_dir = talloc_array(NULL, wchar_t, count); + if (GetCurrentDirectoryW(count, home_dir) != 0) { + char *ret = mp_to_utf8(talloc_ctx, home_dir); + talloc_free(home_dir); + return ret; + } } return NULL; } |