Make your own free website on Tripod.com

files.e

Files.e contains file routines used for loading files and working with paths. It should work on Linux and DOS/Win32.

addSlash

The addSlash function takes a path as an argument, and returns the path ending with a slash (\) so addSlash("c:\euphoria") = "c:\euphoria\". Helpful for adding a file to the path.

absolutePath

The absolutePath function takes a path as an argument, and returns the absolute path. The result always ends with a \, and is always lower case. For example: if you are in c:\euphoria\include, then absolutePath("..\biN") = "c:\euphoria\bin\"

absoluteName

The absoluteName function works like absolutePath, but it assumes that everything after the last \ is a file name. For example: if you are in c:\euphoria\bin, then absoluteName("..\include\graphics.e") = "c:\euphoria\include\graphics.e"

getName

The getName function returns the file name in path. getName("c:\euphoria\doc\library.doc") = "library.doc"

includeName

The includeName function returns the absolute path of an included file. It first checks to see if the file exists relitive to the current directory. If it is found, it returns the absolute path. If it isn't found, it checks the Euphoria include path. If it is found, it returns the absolute path. If it isn't found, it returns "".

Example 1: There is a file in the current directory called files.e. includeName("files.e") = (the current path and "files.e"). So if the current directory is c:\euphoria, includeName("files.e") = "c:\euphoria\files.e".

Example 2: includeName("graphics.e") = "c:\euphoria\include\graphics.e"

Example 3: includeName("file that doesn't exist.e") = ""

Note: includeName uses getenv("EUDIR") so the Euphoria include path is the path where you installed Euphoria and "include".

loadFile

If given a file number, it reads all of the file into a sequence, closes the file, then returns the sequence. If given a file name, it opens that file, reads all of the file into a sequence, closes the file, then returns the sequence. If the file number is -1, it returns "".

Prev: The Source Files

Next: Extending the pre-processor

Table of Contents