Use cwd when a script must be executed with -e or -f (else that breaks make macros) 37/13937/2
Calixte DENIZET [Thu, 6 Mar 2014 14:44:00 +0000 (15:44 +0100)]
Change-Id: Ibdfec2ef5de0ce7797c4e542f883d74ba54e5df3

scilab/modules/core/includes/InitializePreferences.h
scilab/modules/core/src/c/InitializePreferences.c
scilab/modules/core/src/c/realmain.c

index 7e6deb7..6aa1138 100644 (file)
@@ -13,6 +13,6 @@
 #ifndef __INITIALIZEPREFERENCES_H__
 #define __INITIALIZEPREFERENCES_H__
 
-void InitializePreferences();
+void InitializePreferences(int useCWD);
 
 #endif // __INITIALIZEPREFERENCES_H__
index dfb24d8..c0eb38e 100644 (file)
@@ -23,7 +23,7 @@
 #include "HistoryManager.h"
 #include "scicurdir.h"
 
-void InitializePreferences()
+void InitializePreferences(int useCWD)
 {
     const ScilabPreferences * prefs = getScilabPreferences();
     int ieee = 0;
@@ -83,7 +83,7 @@ void InitializePreferences()
     }
 
     // Set current directory
-    if (prefs->startup_dir_use)
+    if (!useCWD && prefs->startup_dir_use)
     {
         if (stricmp(prefs->startup_dir_use, "current"))
         {
index b962b3a..988c6ea 100644 (file)
@@ -158,7 +158,7 @@ int realmain(int no_startup_flag_l, char *initial_script, InitScriptType initial
     }
     /* execute the initial script and enter scilab */
 
-    InitializePreferences();
+    InitializePreferences(initial_script != NULL);
 
 #if !defined(_DEBUG) && defined(_MSC_VER)
     /* if scilab crashs by a exception , we try to quit properly */