AppPath Module
Resolves the application root directory once and returns the root path and the paths of the data, cache, zindex, logs and interactions directories. The root is the directory that holds the data directory, so the development server, a published binary, the Docker container and the test projects all use the same paths. The root is the first of: the directory named by the GENPRES_ROOT environment variable, when that directory exists; the directory of a .env file, searched upward from the current directory and then from the assembly location; the parent of a data/zindex directory, searched upward from the assembly location and then from the current directory; else the current directory, with a warning. The searches for the .env file and the data/zindex directory read the file system directly and do not need Env.loadDotEnv to have run, so test projects and F# scripts find the same root without setup.
Functions and values
| Function or value |
Description
|
Full Usage:
AppPath.GENPRES_ROOT
Returns: string
|
Name of the environment variable that, when set, forces the application
root explicitly. It must point at the directory containing
|
Full Usage:
AppPath.cacheDir ()
Parameters:
unit
Returns: string
|
The
|
Full Usage:
AppPath.dataDir ()
Parameters:
unit
Returns: string
|
The
|
Full Usage:
AppPath.hasEnv dir
Parameters:
string
-
The directory to test.
Returns: bool
true if dir/.env exists.
|
True when dir directly contains a
|
Full Usage:
AppPath.hasZindex dir
Parameters:
string
-
The directory to test.
Returns: bool
true if dir/data/zindex exists.
|
True when dir contains a
|
Full Usage:
AppPath.interactionsDir ()
Parameters:
unit
Returns: string
|
The
|
Full Usage:
AppPath.logsDir ()
Parameters:
unit
Returns: string
|
The
|
Full Usage:
AppPath.resolveRoot ()
Parameters:
unit
Returns: string
|
Resolve the application root from the live environment, current directory, and assembly location. Falls back to the current directory (emitting a warning) when no strategy succeeds.
|
Full Usage:
AppPath.root
Returns: Lazy<string>
|
Lazily resolved, memoized application root. Resolution is deferred so
that any
|
Full Usage:
AppPath.rootPath ()
Parameters:
unit
Returns: string
|
The resolved application root directory (the directory containing
|
Full Usage:
AppPath.tryGetRootInternal genpresRoot currentDir assemblyBaseDir
Parameters:
string option
-
The GENPRES_ROOT override value, if any.
currentDir : string
-
The current working directory to search from.
assemblyBaseDir : string
-
The assembly base directory to search from.
Returns: string option
The resolved root directory, or None if no strategy succeeds.
|
Resolve the application root from the three sources given explicitly.
Pure: takes the
|
Full Usage:
AppPath.zindexDir ()
Parameters:
unit
Returns: string
|
The
|
GenPRES