From 2ba67c230649849c529f33a6e73e42e1fd0268b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 24 Sep 2022 13:34:25 +0200 Subject: [PATCH] Use `SetCurrentDirectoryW` instead of `_wchdir` For more consistent usage of the Windows API. `_wchdir` seems to be a wrapper around `SetCurrentDirectoryW` anyway, at least in the [Wine API](https://source.winehq.org/ident?_i=_wchdir). --- src/base/system.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/base/system.cpp b/src/base/system.cpp index 6041239c4..159fb7e85 100644 --- a/src/base/system.cpp +++ b/src/base/system.cpp @@ -2345,10 +2345,7 @@ int fs_chdir(const char *path) #if defined(CONF_FAMILY_WINDOWS) WCHAR wBuffer[IO_MAX_PATH_LENGTH]; MultiByteToWideChar(CP_UTF8, 0, path, -1, wBuffer, std::size(wBuffer)); - if(_wchdir(wBuffer)) - return 1; - else - return 0; + return SetCurrentDirectoryW(wBuffer) != 0 ? 0 : 1; #else if(chdir(path)) return 1;