Loading...
 
Handling of filenames and paths in iLand

filenames and paths

One rather annoying and often recurring task in the life of a modeller is the need to handle a large amount of files and to maintain paths and file locations in different init- and input-files. Here, iLand tries to reduce the pain a little by providing a way to specify default locations and, generally, by operating with relative paths.

Default locations

Default paths for different types of files are defined in the section system.path in the project file.
Generally, all paths might be given either as absolute or as relative. If relative paths are provided, then they are considered to be relative to the home directory of the project. If the home project setting is empty, the location of the project.xml itself will be used as the the home-directory.
The following table describes the various file types:

keydescription
homethe project's home directory.
databasedatabase directory.
lipdirectory containing the binary LIP files
temptemporary directory (unused)
scriptdefault directory for scripts (e.g. for management)
outputdefault path for the output database(s)
initbase path for tree initialization files

Rules

Whenever a file is specified, following rules apply:

  • if the filename is absolute (i.e. starts with a drive letter), nothing happens. Thus one can always override default locations.
  • if a relative filename is specified (that starts with a directory or filename), then, depending on the context, the filename is expanded to the respective default directory.

Some examples (using Windows file notations):
If given the following values for default directories:

home "e:\projects\projectA"
init "initfiles"
output "c:\temp"

The following filenames would be produced:

(in the context of file inits):
"init_a.csv" "e:\projects\projectA\initfiles\init_a.csv"
"take_two/init_b.csv" "e:\projects\projectA\initfiles\take_two\init_a.csv"
(in the context of outputs)
"outputdb.sqlite" "c:\temp\outputdb.sqlite"

Created by werner. Last Modification: Saturday 10 of March, 2012 13:39:06 CET by werner.