Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский
Scilab Help >> Files : Input/Output functions > Paths - Filenames > get_absolute_file_path

get_absolute_file_path

gives an absolute pathname of a file opened in Scilab

Syntax

[filepath, filename] = get_absolute_file_path()
filepath = get_absolute_file_path(filename)

Arguments

filename

a character string: name of the file.

filepath

a character string: an absolute path.

Description

get_absolute_file_path(filename) searches in Scilab's internal list of currently opened files the file with name filename and returns its path pathname.

If file is not opened, it will return an error.

Without input arguments and called from a script, get_absolute_file_path() returns the absolute path of the script and optionally its name. When called without input arguments from the command line get_absolute_file_path() returns an error.

In previous version (Scilab 5.0.x) current directory was returned if file was not found.

Examples

mputl(['[filepath,filename]=get_absolute_file_path()'
       'disp(filepath,filename)'],TMPDIR+'/script.sce');
exec(TMPDIR+'/script.sce',-1)
fd = mopen(TMPDIR+'/foo.txt','wt');
filepath = get_absolute_file_path("foo.txt")
mclose(fd)
filepath = get_absolute_file_path("foo.txt")

See also

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Jul 20 11:10:43 CEST 2021