Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2025.0.0 - English


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

Report an issue
<< fullpath Paths - Filenames getdrives >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Oct 24 11:13:09 CEST 2024