Hide

YetaWF.Core Package Documentation

Display
Print

YetaWF.Core.Support.Startup.GetEnvironmentFile Method

Returns a file name composed of the current environment and debug/release build, probing for existing files.

Class: YetaWF.Core.Support.Startup
Namespace: YetaWF.Core.Support
Assembly: YetaWF.Core

Syntax

public static string? GetEnvironmentFile(
    string folder,
    string name,
    string ext,
    bool Optional = false );

Parameters

folder

The base folder where the file is located.

name

The base file name.

ext

The file extension.

Optional

(not specified)

Return Value

Returns the file name composed of the current environment and debug/release build, probing for existing files.

Remarks

GetEnvironmentFile(folder, name, ext) return a file path as follows folder/name.Windows|.Linux|.Docker|.Prod|.ext depending on the environment. Release builds contain .Prod, debug builds do not carry a modifier. Running on Windows adds .Windows, running natively on Linux adds .Linux, running in a container adds .Docker.

If the file with modifiers doesn't exist, the default folder/name.ext or folder/name.Prod.ext is returned instead (depending on debug/release build). If folder/name.Prod.ext doesn't exist, folder/name.ext is returned instead.

If no file matching the environment can be found, an exception occurs.

See Also YetaWF.Core.Support.Startup ClassYetaWF.Core Overview