Class PlatformEnvironment
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
public sealed class PlatformEnvironment : IPlatformEnvironment
- Inheritance
-
PlatformEnvironment
- Implements
- Inherited Members
Constructors
PlatformEnvironment(IFileSystem)
Creates a platform environment, deriving Root from RootEnvironmentVariable when set, otherwise from the process base directory.
public PlatformEnvironment(IFileSystem fileSystem)
Parameters
fileSystemIFileSystemThe file system abstraction used to resolve and create paths.
Fields
LogsEnvironmentVariable
Name of the environment variable that overrides the folder the platform logs to (LogsDirectory): what a test or a release check sets, to read the logs of the platform it starts and leave the user's alone. Inherited by spawned children.
public const string LogsEnvironmentVariable = "RDCORE_LOGS_DIRECTORY"
Field Value
RootEnvironmentVariable
Name of the environment variable that overrides the derived root. Set on the entry process; inherited by spawned children.
public const string RootEnvironmentVariable = "RDCORE_PLATFORM_ROOT"
Field Value
SymbolsDirectory
Name of the folder of the platform root that holds the descriptions of the libraries a project can reference (DirectoryLibrarySource).
public const string SymbolsDirectory = "Symbols"
Field Value
UserDataEnvironmentVariable
Name of the environment variable that overrides the folder of the platform's user (UserDataDirectory): what a test sets, so that it never reads nor writes the settings of whoever runs it. Inherited by spawned children.
public const string UserDataEnvironmentVariable = "RDCORE_USER_DATA"
Field Value
Properties
Default
A DI-free instance for bootstrap contexts (e.g. logging configuration).
public static IPlatformEnvironment Default { get; }
Property Value
LogsDirectory
Absolute path of the folder the platform's components write their logs to, created if missing: the user's, not the platform root's, so that a
platform can be installed where its user can't write (Program Files, /opt).
public string LogsDirectory { get; }
Property Value
Remarks
- Windows:
%LOCALAPPDATA%\RDCore\Logs. Local, not roaming: a log is of the machine it was written on. - macOS:
~/Library/Logs/RDCore. - Linux and others:
$XDG_STATE_HOME/rdcore/logs, or~/.local/state/rdcore/logswhereXDG_STATE_HOMEisn't set: the XDG Base Directory Specification places logs in the user's state.
RDCORE_LOGS_DIRECTORY (LogsEnvironmentVariable) overrides it everywhere.
ManifestPath
Absolute path of the platform manifest, <Root>/rdcore.json.
public string ManifestPath { get; }
Property Value
Root
The platform root directory.
public string Root { get; }
Property Value
UserDataDirectory
Absolute path of the folder of the platform's user: %USERAPPDATA%/RDCore, where what the user sets for themselves is kept - their settings
(UserSettingsStore). Not created: nothing is kept there until something is.
public string UserDataDirectory { get; }
Property Value
Remarks
It is not under Root: a platform that is deployed again replaces what is there, and what the user set is theirs to keep.
Methods
Resolve(string)
Resolves a root-relative path (either slash style) to an absolute path under Root.
public string Resolve(string rootRelativePath)