Skip to content

Commit 7ff0c4c

Browse files
author
Brett Schiff
committed
fix for handling of wchars on windows in getting the directory name -- updated with suggestions
1 parent d85f3c9 commit 7ff0c4c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/util/file_util.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,19 @@ std::string get_current_working_directory()
6161
std::string working_directory=wd;
6262
free(wd);
6363
#else
64-
char buffer[4096];
64+
TCHAR buffer[4096];
6565
DWORD retval=GetCurrentDirectory(4096, buffer);
6666
if(retval == 0)
6767
throw system_exceptiont("failed to get current directory of process");
68+
69+
#ifdef UNICODE
70+
std::string working_directory(narrow(buffer));
71+
#else
6872
std::string working_directory(buffer);
6973
#endif
7074

75+
#endif
76+
7177
return working_directory;
7278
}
7379

0 commit comments

Comments
 (0)