From 00744c259cb835af7b3b992a93cd99aad5734f35 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 27 Mar 2017 21:46:06 -0500 Subject: [PATCH] Append the --gui flag if compiled with -DFORCE_GUI. --- package/win/shell.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/package/win/shell.cpp b/package/win/shell.cpp index 2808a2772a..e4fe45d209 100644 --- a/package/win/shell.cpp +++ b/package/win/shell.cpp @@ -23,9 +23,9 @@ int main(int argc, char **argv, char **env) char exe_path[MAX_PATH] = {0}; char script_path[MAX_PATH]; - char gui_flag[7] = {" --gui"}; + char gui_flag[6] = {"--gui"}; #ifdef FORCE_GUI - char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + 1+6)); + char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + 2)); #else char** command_line = (char**)malloc(sizeof(char*) * ((++ argc) + 1)); #endif @@ -72,12 +72,11 @@ int main(int argc, char **argv, char **env) _makepath(script_path, drive, dir, "slic3r", "pl"); command_line[0] = exe_path; command_line[1] = script_path; + memcpy(command_line + 2, argv + 1, sizeof(char*) * (argc - 2)); #ifdef FORCE_GUI - command_line[2] = gui_flag; - memcpy(command_line + 3, argv + 1, sizeof(char*) * (argc - 2)); - command_line[argc+6] = NULL; + command_line[argc] = gui_flag; + command_line[argc+1] = NULL; #else - memcpy(command_line + 2, argv + 1, sizeof(char*) * (argc - 2)); command_line[argc] = NULL; #endif // Unset the PERL5LIB and PERLLIB environment variables. @@ -89,7 +88,11 @@ int main(int argc, char **argv, char **env) printf(" %d: %s\r\n", i, command_line[i]); #endif } +#ifdef FORCE_GUI + RunPerl(argc+1, command_line, NULL); +#else RunPerl(argc, command_line, NULL); +#endif free(command_line); }