+
+ // Remove PYTHONPATH from the environment as it may point to an
+ // external python installation and cause reconfigure failures.
+ unsetEnv("PYTHONPATH");
+
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+ // Removing an argument from argv leads to an assertion on Windows
+ // when compiling with MSVC 2015 in debug mode (see bug #10440).
+ // To avoid this we make a copy of the array of pointers.
+ char ** newargv = (char **) malloc((argc + 1) * sizeof(char *));
+ if (newargv) {
+ memcpy(newargv, *argv, (argc + 1) * sizeof(char *));
+ *argv = newargv;
+ } else {
+ lyxerr << "LyX warning: Cannot make a copy of "
+ "command line arguments!"
+ << endl;
+ }
+#endif
+
+
+ // Get the wide program arguments array
+#if defined(_MSC_VER) && (_MSC_VER >= 1900)
+ argv_ = CommandLineToArgvW(GetCommandLineW(), &argc_);
+#else
+ wchar_t ** envp = 0;
+ int newmode = 0;
+ __wgetmainargs(&argc_, &argv_, &envp, -1, &newmode);
+#endif
+ LATTEST(argc == argc_);
+
+ // If Cygwin is detected, query the cygdrive prefix.
+ // The cygdrive prefix is needed for translating windows style paths
+ // to posix style paths in LaTeX files when the Cygwin teTeX is used.
+ int i;
+ HKEY hkey;