diff --git a/launcher/windows/CMakeLists.txt b/launcher/windows/CMakeLists.txt new file mode 100644 index 00000000..4f1ec280 --- /dev/null +++ b/launcher/windows/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.14) + +project(novelWriter LANGUAGES CXX) + +add_executable(novelWriter main.cpp launcher.rc) diff --git a/launcher/windows/launcher.rc b/launcher/windows/launcher.rc new file mode 100644 index 00000000..e8851a86 --- /dev/null +++ b/launcher/windows/launcher.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "novelwriter.ico" diff --git a/launcher/windows/main.cpp b/launcher/windows/main.cpp new file mode 100644 index 00000000..a6f9c0e2 --- /dev/null +++ b/launcher/windows/main.cpp @@ -0,0 +1,30 @@ +#include +#include +#include +#include + +void _tmain( int argc, TCHAR *argv[] ) { + STARTUPINFO si; + PROCESS_INFORMATION pi; + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + ZeroMemory(&pi, sizeof(pi)); + + TCHAR fileName[MAX_PATH]; + auto pathlen = GetModuleFileName(NULL, fileName, MAX_PATH); + fileName[pathlen - 15] = 0; + SetCurrentDirectory(fileName); + std::cout << "WorkDir: " << fileName << std::endl; + + TCHAR cmd[MAX_PATH] = "pythonw.exe novelWriter.pyw"; + if (argc > 1) { + _tcscat_s(cmd, TEXT(" ")); + _tcscat_s(cmd, argv[1]); + } + std::cout << "Command: " << cmd << std::endl; + + CreateProcess(NULL, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + + return; +} diff --git a/launcher/windows/novelwriter.ico b/launcher/windows/novelwriter.ico new file mode 100644 index 00000000..54301ffe Binary files /dev/null and b/launcher/windows/novelwriter.ico differ