EnvironmentHelper
This module contains functions which allow to read and write environment variables and build parameters
Nested types and modules
Type | Description |
EnvironTarget |
Type alias for System.EnvironmentVariableTarget |
MachineDetails |
A record which allows to display lots of machine specific information like machine name, processor count etc. |
Functions and values
Function or value | Description |
( @@ ) path1 path2
Signature: path1:string -> path2:string -> string
|
Combines two path strings using Path.Combine after removing leading slashes from the second path |
( </> ) path1 path2
Signature: path1:string -> path2:string -> string
|
Combines two path strings using Path.Combine |
appSetting(name)
Signature: name:string -> string
|
Retrieves the application settings variable with the given name |
clearProcessEnvironVar(name)
Signature: name:string -> unit
|
Clears the environment variable with the given name for the current process. |
combinePaths path1 path2
Signature: path1:string -> path2:string -> string
|
Combines two path strings using Path.Combine after removing leading slashes from the second path |
combinePathsNoTrim path1 path2
Signature: path1:string -> path2:string -> string
|
Combines two path strings using Path.Combine |
convertWindowsToCurrentPath(windowsPath)
Signature: windowsPath:string -> string
|
Convert the given windows path to a path in the current system |
directorySeparator
Signature: string
|
The directory separator string. On most systems / or \ |
documentsFolder
Signature: string
|
The path to the personal documents |
encoding
Signature: Encoding
|
Contains the IO encoding which is given via build parameter "encoding" or the default encoding if no encoding was specified. |
environVar(name)
Signature: name:string -> string
|
Retrieves the environment variable with the given name |
environVarOrDefault name defaultValue
Signature: name:string -> defaultValue:string -> string
|
Retrieves the environment variable with the given name or returns the default if no value was set |
environVarOrFail(name)
Signature: name:string -> string
|
Retrieves the environment variable with the given name or fails if not found |
environVarOrNone(name)
Signature: name:string -> string option
|
Retrieves the environment variable or None if no value was set |
environVars(target)
Signature: target:EnvironmentVariableTarget -> (obj * obj) list
|
Retrieves all environment variables from the given target |
getBuildParam(name)
Signature: name:string -> string
|
Returns the value of the build parameter with the given name if it was set and otherwise an empty string |
getBuildParamOrDefault name defaultParam
Signature: name:string -> defaultParam:string -> string
|
Returns the value of the build parameter with the given name if it was set and otherwise the given default value |
getDrivesInfo()
Signature: unit -> seq<string>
|
Retrieves information about the hard drives |
getEnvironmentVarAsBool(varName)
Signature: varName:string -> bool
|
Retrieves the environment variable with the given name or returns false if no value was set |
getEnvironmentVarAsBoolOrDefault(...)
Signature: varName:string -> defaultValue:bool -> bool
|
Retrieves the environment variable with the given name or returns the default value if no value was set |
getInstalledDotNetFrameworks()
Signature: unit -> seq<string>
|
Returns a sequence with all installed .NET framework versions |
getMachineEnvironment()
Signature: unit -> MachineDetails
|
Retrieves lots of machine specific information like machine name, processor count etc. |
getNewestTool(possibleToolPaths)
Signature: possibleToolPaths:seq<'a> -> 'a
Type parameters: 'a |
Helper function to help find framework or sdk tools from the newest toolkit available |
getTargetPlatformDir(platformVersion)
Signature: platformVersion:string -> string
|
Gets the local directory for the given target platform |
hasBuildParam(name)
Signature: name:string -> bool
|
Returns if the build parameter with the given name was set |
isLinux
Signature: bool
|
Determines if the current system is a Linux system |
isMacOS
Signature: bool
|
Determines if the current system is a MacOs system |
isMono
Signature: bool
|
Determines if the current system is a mono system Todo: Detect mono on windows |
isUnix
Signature: bool
|
Determines if the current system is an Unix system |
isWindows
Signature: bool
|
Determines if the current system is a Windows system |
monoArguments
Signature: string
|
Arguments on the Mono executable |
monoPath
Signature: string
|
|
monoVersion
Signature: (string * Version option) option
|
required sometimes to workaround mono crashes http://stackoverflow.com/a/8414517/1269722 |
msSdkBasePath
Signature: string
|
Base path for getting tools from Microsoft SDKs |
normalizePath(path)
Signature: path:string -> string
|
|
platformInfoAction(psi)
Signature: psi:ProcessStartInfo -> unit
|
Modifies the ProcessStartInfo according to the platform semantics |
ProgramFiles
Signature: string
|
The path of the "Program Files" folder - might be x64 on x64 machine |
ProgramFilesX86
Signature: string
|
The path of Program Files (x86) It seems this covers all cases where PROCESSOR_ARCHITECTURE may misreport and the case where the other variable PROCESSOR_ARCHITEW6432 can be null |
sdkBasePath
Signature: string
|
Base path for getting tools from Windows SDKs |
setBuildParam name value
Signature: name:string -> value:string -> unit
|
Sets the build parameter with the given name for the current process. |
setEnvironVar name value
Signature: name:string -> value:string -> unit
|
Sets the environment variable with the given name |
setMachineEnvironVar name value
Signature: name:string -> value:string -> unit
|
Sets the environment variable with the given name for the current machine. |
setProcessEnvironVar name value
Signature: name:string -> value:string -> unit
|
Sets the environment variable with the given name for the current process. |
setUserEnvironVar name value
Signature: name:string -> value:string -> unit
|
Sets the environment variable with the given name for the current user. |
splitEnvironVar(name)
Signature: name:string -> string list
|
Splits the entries of an environment variable and removes the empty ones. |
SystemRoot
Signature: string
|
The system root environment variable. Typically "C:\Windows" |
TargetPlatformPrefix
Signature: string
|
The path of the current target platform |