Windows C++ devs:
My main project is a Python + Qt GUI application. Distributing that as-is on Linux is easy. On Windows, a little trickier.
What I do now is distribute it with Python embeddable and pure Python code. That's fine, but it makes the launching a little tricky.
I'm currently trying to create a trivial C++ exec that just launches the correct files via CreateProcess().
Does this sound like a good idea? Code linked below.
https://github.com/vkbo/novelWriter/tree/windows_launcher/launcher/windows
> That's fine, but it makes the launching a little tricky.
Sorry this is a bit of a detour, but why is this? Is it due to attaching correct file extensions to the correct executable, or is it due to the way that the executable needs to be launched?
@onghu The launchers basically have to point to the embedded Python with novelWriter as an argument, and the folder as the working directory. It works as long as people don't touch anything, but it also means it is tricky to add any other custom way to start it.
See the [Icons] and [Run] sections: https://github.com/vkbo/novelWriter/blob/main/setup/win_setup_embed.iss
With the exe I generated with the solution mentioned in the original post, the exe will work even when double clicked. It effectively makes the app standalone and movable.
@veronica
Thanks I wonder if it's possible to:
* Have a BAT/ CMD file that does the correct thing
* Add a registry entry if there's a specific extension (e.g., ".nwr") which launches the .BAT file
@veronica
Ah, I just noticed that it needs the working directory, hmm, let me see how that could be done
@onghu I mean, everything currently works, but if you accidentally delete the shortcut icon, you cannot easily recreate it by right-clicking in Program Files.
The shortcuts also point to pythonw.exe everywhere rather than the actual app.
You can of course point to a bat script, but that doesn't really change anything. The exe I'm making now effectively does the same as such a bat file would, but it has an icon, meta data, and will start the app without a terminal window if you double-click it.
@veronica
I understand. In that case, it sounds like a perfect solution - to answer the question in your original post.