-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a minimal launcher for novelWriter on Windows
- Loading branch information
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cmake_minimum_required(VERSION 3.14) | ||
|
||
project(novelWriter LANGUAGES CXX) | ||
|
||
add_executable(novelWriter main.cpp launcher.rc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
IDI_ICON1 ICON DISCARDABLE "novelwriter.ico" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <windows.h> | ||
#include <stdio.h> | ||
#include <tchar.h> | ||
#include <iostream> | ||
|
||
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; | ||
} |
Binary file not shown.