[scilab-Users] How to get the current script directory ?

Samuel Gougeon Samuel.Gougeon at univ-lemans.fr
Mon Apr 19 12:21:53 CEST 2010


----- Message d'origine -----
De : Gary Nelson
Date : 17/04/2010 21:46:
> This looks useful, but I can't get it to work.
>
> I open the editor and load two files. One is a function called by the other file. I execute the tester.
> Then go to the console and invoke get_absolute_file_path(script_filename).
>
> I find the file name wants to be inside double quotes,
yes, script_filename should be a string (variable or literal)
>  but even then I get an error that the file is not open in Scilab, despite having just executed it. I have tried both the function and the tester and get the same error -- file not open in Scilab.
>   
Interesting remark. Actually, for a file, being opened in the editor 
does not mean being opened in the Scilab session (console), even if the 
editor has been launched from the session. I agree that this does not 
look obvious. To check that : open a file in xpad (embedded editor); 
then in the console: dispfiles()  => The file opened in xpad is not listed.
Moreover : The file is opened while it is beING executed. This is why in 
practical, get_absolute_file_path() can be used either in .sce scripts 
(list of instructions) ; or whether the file has been opened with 
mopen() of file(... "open"), and is currently running.

Samuel




More information about the users mailing list