call of .scilab and scilab.ini fixed 68/15668/3
Cedric Delamarre [Mon, 8 Dec 2014 12:29:37 +0000 (13:29 +0100)]
Interactive test bug_4150.

Change-Id: I8a6c12e7886f07a6f44e4e3d0b7a3c6d2a31933e

scilab/etc/scilab.start

index f3e6dde..1014246 100644 (file)
@@ -141,19 +141,28 @@ if sciargs()<>"-nouserstartup" then
 
   startupfiles = [ SCIHOME + filesep() + ".scilab"     ; .. // Home directory startup
                    SCIHOME + filesep() + "scilab.ini" ];    //  ""      ""    startup
-
-  if SCIHOME <> pwd() then
-    startupfiles = [ startupfiles     ; ..
-                     ".scilab"        ; .. // Working directory startup
-                     "scilab.ini" ]   ;    //  ""         ""    startup
-  end
-
   for i = 1:size(startupfiles, "*")
     if isfile(startupfiles(i)) then
       exec(startupfiles(i),-1);
     end
   end
 
+  // execute .scilab and scilab.start only
+  // if last exec does not change current directory to SCIHOME
+  // See bug #4150
+  workingDirectory = pwd();
+  if SCIHOME <> workingDirectory then
+
+      workingfiles = [ workingDirectory + filesep() + ".scilab"     ; .. // Working directory startup
+                       workingDirectory + filesep() + "scilab.ini" ];    //  ""      ""    startup
+
+      for i = 1:size(startupfiles, "*")
+        if isfile(startupfiles(i)) then
+          exec(startupfiles(i),-1);
+        end
+      end
+  end
+
   clear i;
   clear startupfiles;
 end