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).
This commit is contained in:
Robert Müller 2022-09-24 13:34:25 +02:00
parent 8fb79242bf
commit 2ba67c2306

View file

@ -2345,10 +2345,7 @@ int fs_chdir(const char *path)
#if defined(CONF_FAMILY_WINDOWS) #if defined(CONF_FAMILY_WINDOWS)
WCHAR wBuffer[IO_MAX_PATH_LENGTH]; WCHAR wBuffer[IO_MAX_PATH_LENGTH];
MultiByteToWideChar(CP_UTF8, 0, path, -1, wBuffer, std::size(wBuffer)); MultiByteToWideChar(CP_UTF8, 0, path, -1, wBuffer, std::size(wBuffer));
if(_wchdir(wBuffer)) return SetCurrentDirectoryW(wBuffer) != 0 ? 0 : 1;
return 1;
else
return 0;
#else #else
if(chdir(path)) if(chdir(path))
return 1; return 1;