[scilab-Users] How to get a script's directory

Yann Collette yann.collette at scilab.org
Sun Jun 21 08:30:51 CEST 2009


ZeWaren / Erwan Martin a écrit :
> Hi,
> I'm writing scilab scripts (.sci files) on a daily basic.
> Theses scripts need to access some files around them, typically graphs.
>
> How can I get the location of the script in a variable, so that I can 
> do something like this?:
>    cpath=get_script_path();
>    graph=load_graph(cpath+'some_graph.graph');
> I need to be able to execute my scripts on different computers in 
> different places on different operating systems.
> I know that I can get scilab's current working directory using pwd() 
> and change it using cd(...), but this doesn't solve my problem.
>
> Thanks for any response.
>
Try path = get_absolute_file_path(('your_script_name.sci');

YC




More information about the users mailing list