1 //
2 // SetCurrentDirectoryA.cpp
3 //
4 //      Copyright (c) Microsoft Corporation. All rights reserved.
5 //
6 // Definition of __acrt_SetCurrentDirectoryA.
7 //
8 
9 #include <corecrt_internal_win32_buffer.h>
10 
__acrt_SetCurrentDirectoryA(LPCSTR const lpPathName)11 BOOL __cdecl __acrt_SetCurrentDirectoryA(
12     LPCSTR const lpPathName
13     )
14 {
15     __crt_internal_win32_buffer<wchar_t> wide_path_name;
16 
17     errno_t const cvt1 = __acrt_mbs_to_wcs_cp(
18         lpPathName,
19         wide_path_name,
20         __acrt_get_utf8_acp_compatibility_codepage()
21         );
22 
23     if (cvt1 != 0) {
24         return FALSE;
25     }
26 
27     return ::SetCurrentDirectoryW(wide_path_name.data());
28 }
29