diff options
author | nanahi <130121847+na-na-hi@users.noreply.github.com> | 2024-02-23 18:08:55 -0500 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-02-25 14:30:20 +0100 |
commit | ab3a63285a44e6b41e171e737950d8d266ca79db (patch) | |
tree | 8f450bdd0695820a1757d435dc9c5c796ea42ce2 /osdep/io.c | |
parent | 748504de520fc450fb8e73f3bdc663650fa864bf (diff) | |
download | mpv-ab3a63285a44e6b41e171e737950d8d266ca79db.tar.bz2 mpv-ab3a63285a44e6b41e171e737950d8d266ca79db.tar.xz |
osdep/io: add mp_unlink()
unlink() was never wrapped in win32, so all usages of it were referring
the ANSI version of the function. This doesn't work properly for Windows
versions before 1903 (where the UTF-8 codepage is requested).
Fix this by adding mp_unlink() which wraps over _wunlink().
Diffstat (limited to 'osdep/io.c')
-rw-r--r-- | osdep/io.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/osdep/io.c b/osdep/io.c index 18c2a83f94..d66160c0e7 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -621,6 +621,14 @@ int mp_mkdir(const char *path, int mode) return res; } +int mp_unlink(const char *path) +{ + wchar_t *wpath = mp_from_utf8(NULL, path); + int res = _wunlink(wpath); + talloc_free(wpath); + return res; +} + char *mp_win32_getcwd(char *buf, size_t size) { if (size >= SIZE_MAX / 3 - 1) { |