dadllfile_path

Usage Description

This library contains functions to handle files and paths like expanding for the #-character, constructing paths, and so on.

Limitation: the functions in this library currently cannot handle drive names, like \\server\data\file.

DLL Prototypes

function extern long check.and.create.dir(
                const string path() )
 pre   : not isspace(path) post  : the path <path> will be created if not
already existing return: whether the path <path> exists (or could be created)
desc  : if necessary this function also creates subdirectories
        ${<env_var>} can be used but no subdirectories in the
        ${<env_var>} are tested).
 function extern string expand.path(
                const string path(),
                [ long comp ] )
 pre   : path (not necessarily stripped) post  : path (stripped) with all
#-characters replaced by the company
        number comp (or the current company if not provided).
 function extern string get.full.file(
                const string path(),
                const string file() )
 pre   : parameters don't have to be stripped return: the full file name desc  :
this function tries to concatenate path and file into a full
        file name defined as: path/file
        This will only be done if:
        - both path and file are not empty
        - file itself is not an absolute path (beginning with / or $)
        Otherwise just file will be returned.
 function extern string get.log.filename(
                domain daxch.txch xch.type,
                const domain daxch.cxch xch.scheme,
                const domain daxch.cbat batch,
                long run.num,
                domain daxch.pint try.num,
                const string seq.path(),
                [ long comp ] )
 pre   : parameters do not have to be stripped return: the full file name where
the logfile is to be located:
        -regular import:

<seq.path>/<xch.scheme>.<run.num>.i/log.<batch>.<run.num>.<try.num>
        -non-regular import: <seq.path>/log.<batch>.<run.num>.<try.num>
        -regular export:

<seq.path>/<xch.scheme>.<run.num>.e/exp.<batch>.<run.num>.<try.num>
        -non-regular export: <seq.path>/exp.<batch>.<run.num>.<try.num>
 function extern string get.object.path(
                const domain daxch.cxch xch.scheme,
                [ long comp ] )
 pre   : true return: the path where objects (and error files) should be stored.
        empty if xch.scheme does not exist
 function extern get.path.filename(
                const string full.path(),
                ref string path.name(),
                ref string file.name() )
 pre   : true post  : <full.path> is split into the path part (in <path.name>)
        and the file name part (in <file.name>)
 function extern string get.seq.filename(
                domain daxch.txch xch.type,
                const domain daxch.cxch xch.scheme,
                long run.num,
                const string seq.path(),
                const string sub.dir(),
                const string seq.file(),
                [ long comp ] )
 pre   : parameters do not have to be stripped return: the full file name where
an exchange file is (to be) located
        (with # expanded with the company number):
        -regular export and isspace(sub.dir):
         <seq.path>/<xch.scheme>.<run.num>.e/<seq.file>
        -regular export and not isspace(sub.dir):
         <seq.path>/<sub.dir>.<run.num>/<seq.file>
        -regular import and isspace(sub.dir):
         <seq.path>/<xch.scheme>.<run.num>.i/<seq.file>
        -regular import and not isspace(sub.dir):
         <seq.path>/<sub.dir>.<run.num>/<seq.file>
        -non-regular   :
        -<seq.path>/<seq.file>
        but if seq.file is a pathname in itself (starts with a $ or /)
        then <seq.file>
 function extern long path.exists(
                const domain daxch.path path )
 pre   : true return: whether the directory <path.name> exists