From ae6308734acb316a880d020531c765cf22cf84ba Mon Sep 17 00:00:00 2001 From: Samuel GOUGEON Date: Tue, 2 Aug 2016 18:46:53 +0200 Subject: [PATCH] * Bug #14690 fixed - User's startup files were executed twice or never http://bugzilla.scilab.org/14690 Change-Id: I388cdd9b10afbec2f0a43cae720ea6c4ace83d3c --- scilab/CHANGES.md | 3 ++- scilab/etc/scilab.start | 28 +++++++++++++++++----------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index 050b60a..f205625 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -261,9 +261,10 @@ Bug Fixes * [Bug #14602](http://bugzilla.scilab.org/show_bug.cgi?id=14602) fixed - WRITEC_f block didn't work for x86 machines. * [Bug #14640](http://bugzilla.scilab.org/show_bug.cgi?id=14640) fixed - `median(int8([10 60 80 100]))` returned -58 instead of 70 due to overflow when interpolating (60+80)>128 * [Bug #14648](http://bugzilla.scilab.org/show_bug.cgi?id=14648) fixed - `isinf` returned `%F` for complex numbers with both real and imag infinite parts. +* [Bug #14649](http://bugzilla.scilab.org/show_bug.cgi?id=14649) fixed - isnan(complex(%inf, %inf)) returned %F while the phase is NaN. * [Bug #14662](http://bugzilla.scilab.org/show_bug.cgi?id=14662) fixed - Matrix of strings concatenation with single quote led to a parser error. * [Bug #14681](http://bugzilla.scilab.org/show_bug.cgi?id=14681) fixed - Short-circuited AND operation was not possible with double matrices in if and while clauses -* [Bug #14649](http://bugzilla.scilab.org/show_bug.cgi?id=14649) fixed - isnan(complex(%inf, %inf)) returned %F while the phase is NaN. +* [Bug #14690](http://bugzilla.scilab.org/show_bug.cgi?id=14690) fixed - The user's startup files set in the working directory were not executed. When `SCIHOME` is not the working directory, `SCIHOME\scilab.ini` was executed twice. ### In 6.0.0 beta-2 and earlier: diff --git a/scilab/etc/scilab.start b/scilab/etc/scilab.start index 9d143ad..78199ef 100644 --- a/scilab/etc/scilab.start +++ b/scilab/etc/scilab.start @@ -98,33 +98,39 @@ loadContrib(); clear loadContrib; // calling user initialization ========================================= -if sciargs()<>"-nouserstartup" then +if ~or(sciargs()=="-nouserstartup") then startupfiles = [ SCIHOME + filesep() + ".scilab" ; .. // Home directory startup SCIHOME + filesep() + "scilab.ini" ]; // "" "" startup - for i = 1:size(startupfiles, "*") - if isfile(startupfiles(i)) then - exec(startupfiles(i),-1); + for f = startupfiles' + if isfile(f) then + exec(f, -1) end end // execute .scilab and scilab.start only // if last exec does not change current directory to SCIHOME // See bug #4150 - workingDirectory = pwd(); + usedwd = getPreferencesValue("//general/body/startup", "use"); + if usedwd=="previous" + workingDirectory = getPreferencesValue("//general/body/startup", "previous"); + elseif usedwd=="default" + workingDirectory = getPreferencesValue("//general/body/startup", "default"); + else + workingDirectory = pwd(); + end if SCIHOME <> workingDirectory then - - workingfiles = [ workingDirectory + filesep() + ".scilab" ; .. // Working directory startup + startupfiles = [ 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); + for f = startupfiles' + if isfile(f) then + exec(f, -1) end end end - clear i startupfiles workingfiles workingDirectory; + clear usedwd f startupfiles workingDirectory end // Menus/toolbar can now be enabled ==================================== -- 1.7.9.5