@@ -203,24 +203,16 @@ class Win32Env : public Env
203
203
204
204
void ToWidePath (const std::string& value, std::wstring& target) {
205
205
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);
207
207
target = buffer;
208
208
}
209
209
210
210
void ToNarrowPath (const std::wstring& value, std::string& target) {
211
211
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 );
213
213
target = buffer;
214
214
}
215
215
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
-
224
216
std::wstring GetCurrentDirW ()
225
217
{
226
218
WCHAR path[MAX_PATH];
@@ -229,6 +221,13 @@ std::wstring GetCurrentDirW()
229
221
return std::wstring (path);
230
222
}
231
223
224
+ std::string GetCurrentDir ()
225
+ {
226
+ std::string path;
227
+ ToNarrowPath (GetCurrentDirW (), path);
228
+ return path;
229
+ }
230
+
232
231
std::string& ModifyPath (std::string& path)
233
232
{
234
233
if (path[0 ] == ' /' || path[0 ] == ' \\ ' ){
0 commit comments