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

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

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

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

Copyright (c) 2022-2023 (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:
Mon Jan 03 14:23:28 CET 2022