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

- dispfiles
- file()
- getshortpathname
- getlongpathname
- pwd