Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-08-07 22:20:43 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-08-07 22:22:57 +0400
commit57c4871146269a34522ad50c43cb55fe773f3bdf (patch)
tree92c909a5b7a696bdda21c5b969671ef477ecacc3 /source/creator
parenta108532eb93d96a2c8dea7e21533d953d0eee2c3 (diff)
Tweaks to the recent wrapper on windows
- Forgot to handle command line arguments - Because of the fact we need to be able to use stdout and stderr we need to use regular console application for the wrapper. - Because of using regular application for the wrapper we need to check forparent PID in the isStartedFromCommandPrompt(). I really hope it's not gonna to become any more complicated.
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/creator_launch_win.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/source/creator/creator_launch_win.c b/source/creator/creator_launch_win.c
index 0f186f643db..e998343c876 100644
--- a/source/creator/creator_launch_win.c
+++ b/source/creator/creator_launch_win.c
@@ -23,8 +23,6 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#pragma comment(linker, "/subsystem:windows")
-
/* Binary name to launch. */
#define BLENDER_BINARY "blender-app.exe"
@@ -33,21 +31,29 @@
#include <stdlib.h>
#include <windows.h>
-int WINAPI WinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- LPSTR lpCmdLine,
- int nCmdShow)
+int main(int argc, char **argv)
{
PROCESS_INFORMATION processInformation = {0};
STARTUPINFOA startupInfo = {0};
BOOL result;
+ char command[65536];
+ int i, len = sizeof(command);
_putenv_s("OMP_WAIT_POLICY", "PASSIVE");
startupInfo.cb = sizeof(startupInfo);
- result = CreateProcessA(NULL, BLENDER_BINARY, NULL, NULL, FALSE,
- 0, NULL, NULL,
- &startupInfo, &processInformation);
+
+ strncpy(command, BLENDER_BINARY, len - 1);
+ len -= strlen(BLENDER_BINARY);
+ for (i = 1; i < argc; ++i) {
+ strncat(command, " ", len - 1);
+ strncat(command, argv[i], len - 2);
+ len -= strlen(argv[i]) + 1;
+ }
+
+ result = CreateProcessA(NULL, command, NULL, NULL, TRUE,
+ 0, NULL, NULL,
+ &startupInfo, &processInformation);
if (!result) {
fprintf(stderr, "Error launching " BLENDER_BINARY "\n");