diff --git a/editor/editor.cpp b/editor/editor.cpp index 7adbc0c..0f8def8 100644 --- a/editor/editor.cpp +++ b/editor/editor.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -673,7 +674,17 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, if (NULL == hwnd) die("Window Creation Failed!"); - fileNew(); + LPWSTR *argv; + int argc; + if ((argv = CommandLineToArgvW(GetCommandLineW(), &argc)) && argc > 1) { + if (argc > 2) { + char prog[MAX_PATH]; + GetModuleFileNameA(NULL, prog, sizeof(prog)); + die("usage: %s [filename.rocket]", prog); + } + loadDocument(argv[1]); + } else + fileNew(); HACCEL accel = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDR_ACCELERATOR));