diff 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
line wrap: on
line diff
--- a/installer-files/octave-launch.c	Sat Nov 20 14:09:41 2021 +0100
+++ b/installer-files/octave-launch.c	Sat Nov 20 15:34:20 2021 +0100
@@ -246,6 +246,18 @@
          detect that.  */
     }
 
+#ifdef FIRST_TIME
+  {
+    /* change directory to USERPROFILE before starting Octave */
+    wchar_t tmpbuff[PATH_SZ];
+    nSize = GetEnvironmentVariableW (L"USERPROFILE", tmpbuff, PATH_SZ-1);
+    if (nSize)
+      StringCchCopyW (path, PATH_SZ, tmpbuff);
+
+    SetCurrentDirectoryW (path);
+  }
+#endif
+
   /* set up process args and start it */
   {
     STARTUPINFO si;