@@ -203,24 +203,16 @@ class Win32Env : public Env
203203
204204void ToWidePath (const std::string& value, std::wstring& target) {
205205 wchar_t buffer[MAX_PATH];
206- MultiByteToWideChar (CP_ACP , 0 , value.c_str (), -1 , buffer, MAX_PATH);
206+ MultiByteToWideChar (CP_UTF8 , 0 , value.c_str (), -1 , buffer, MAX_PATH);
207207 target = buffer;
208208}
209209
210210void ToNarrowPath (const std::wstring& value, std::string& target) {
211211 char buffer[MAX_PATH];
212- WideCharToMultiByte (CP_ACP , 0 , value.c_str (), -1 , buffer, MAX_PATH, NULL , NULL );
212+ WideCharToMultiByte (CP_UTF8 , 0 , value.c_str (), -1 , buffer, MAX_PATH, NULL , NULL );
213213 target = buffer;
214214}
215215
216- std::string GetCurrentDir ()
217- {
218- CHAR path[MAX_PATH];
219- ::GetModuleFileNameA (::GetModuleHandleA(NULL ),path,MAX_PATH);
220- *strrchr (path,' \\ ' ) = 0 ;
221- return std::string (path);
222- }
223-
224216std::wstring GetCurrentDirW ()
225217{
226218 WCHAR path[MAX_PATH];
@@ -229,6 +221,13 @@ std::wstring GetCurrentDirW()
229221 return std::wstring (path);
230222}
231223
224+ std::string GetCurrentDir ()
225+ {
226+ std::string path;
227+ ToNarrowPath (GetCurrentDirW (), path);
228+ return path;
229+ }
230+
232231std::string& ModifyPath (std::string& path)
233232{
234233 if (path[0 ] == ' /' || path[0 ] == ' \\ ' ){
0 commit comments