diff --git a/Tilandis/Tilandis.cpp b/Tilandis/Tilandis.cpp index ce231d4..31fd018 100644 --- a/Tilandis/Tilandis.cpp +++ b/Tilandis/Tilandis.cpp @@ -10,14 +10,16 @@ #include "Utility.h" std::wstring Tilandis::BaseDirectory = L""; -int CALLBACK wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR lpCmdLine, int nShow) { +int CALLBACK wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR, int nShow) { + // Note to self: Do not EVER, under ANY circumstances, use the lpCmdLine parameter passed to wWinMain + // That parameter is full of lies and deceit and cannot be trusted LPWSTR* argv; int argc; - argv = CommandLineToArgvW(lpCmdLine, &argc); - std::wcout << argv << std::endl; + argv = CommandLineToArgvW(GetCommandLineW(), &argc); wchar_t* argvzero = new wchar_t[65535]; GetModuleFileName(NULL, argvzero, 65535); + std::wstring argvzerostr = argvzero; Tilandis::BaseDirectory = Utility::basedir(argvzerostr); diff --git a/Tilandis/cmdline.cpp b/Tilandis/cmdline.cpp index 2f40e61..581997c 100644 --- a/Tilandis/cmdline.cpp +++ b/Tilandis/cmdline.cpp @@ -27,7 +27,7 @@ bool Tilandis::UsingCommandLine(int argc, wchar_t* argv[]) { bool lookingforarg = false; // bool longstr = false; // possibly redundant std::wstring curargstr; // shorthand for developer convenience. the compiler will probably optimize this one away - for (int curarg = 0; curarg < argc; curarg++) { + for (int curarg = 1; curarg < argc; curarg++) { curargstr = argv[curarg]; if (lookingforarg) { if (curargstr[0] == L'-') {