comparison installer-files/octave-launch.c @ 5957:9cd5425b033b

octave-launch-firsttime: New launcher executable for starting Octave first time. * installer-files/octave-launch.c: Conditionally change to USERPROFILE before running Octave. * binary-dist-rules.mk(octave-launch-firsttime, installer-files/octave-launch-firsttime.exe): Add build rules for new launcher executable. (copy-windows-dist-files): Copy octave-launch-firsttime.exe to $(OCTAVE_DIST_DIR).
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 20 Nov 2021 15:34:20 +0100
parents b8e9589b7794
children 49b3f6c6d255
comparison
equal deleted inserted replaced
5956:b8e9589b7794 5957:9cd5425b033b
244 /* NOTE: specifying both --no-gui and --gui is also an 244 /* NOTE: specifying both --no-gui and --gui is also an
245 inconsistent set of options but we leave it to octave.exe to 245 inconsistent set of options but we leave it to octave.exe to
246 detect that. */ 246 detect that. */
247 } 247 }
248 248
249 #ifdef FIRST_TIME
250 {
251 /* change directory to USERPROFILE before starting Octave */
252 wchar_t tmpbuff[PATH_SZ];
253 nSize = GetEnvironmentVariableW (L"USERPROFILE", tmpbuff, PATH_SZ-1);
254 if (nSize)
255 StringCchCopyW (path, PATH_SZ, tmpbuff);
256
257 SetCurrentDirectoryW (path);
258 }
259 #endif
260
249 /* set up process args and start it */ 261 /* set up process args and start it */
250 { 262 {
251 STARTUPINFO si; 263 STARTUPINFO si;
252 #define ARGBUF_SZ 4096 264 #define ARGBUF_SZ 4096
253 wchar_t argbuffer[ARGBUF_SZ]; 265 wchar_t argbuffer[ARGBUF_SZ];