Set ?data in a way that works with spaces in the path on Windows

This commit is contained in:
Thomas Goyne 2013-02-06 19:15:21 -08:00
parent 9a69017752
commit 2bad9029cb

View file

@ -44,11 +44,10 @@ void Path::FillPlatformSpecificPaths() {
SetToken("?user", WinGetFolderPath(CSIDL_APPDATA)/"Aegisub"); SetToken("?user", WinGetFolderPath(CSIDL_APPDATA)/"Aegisub");
SetToken("?local", WinGetFolderPath(CSIDL_LOCAL_APPDATA)/"Aegisub"); SetToken("?local", WinGetFolderPath(CSIDL_LOCAL_APPDATA)/"Aegisub");
/// @todo error checking std::wstring filename(MAX_PATH + 1, L'\0');
int argc; while (static_cast<DWORD>(filename.size()) == GetModuleFileNameW(nullptr, &filename[0], filename.size()))
LPWSTR *argv = CommandLineToArgvW(L"", &argc); filename.resize(filename.size() * 2);
SetToken("?data", argv[0]); SetToken("?data", filename);
LocalFree(argv);
SetToken("?dictionary", Decode("?data/dictionaries")); SetToken("?dictionary", Decode("?data/dictionaries"));
//SetToken("?docs", Decode("?data/docs")); //SetToken("?docs", Decode("?data/docs"));