Table of Contents

Aliases

File locations are referenced using aliases. An alias is the equivalent of a drive letter or a UNC path. It is a name that points to a directory or a file share.

If you create an alias called MY_FILES and point it to C:\Files\Me, then you can access files in the folder C:\Files\Me\Documents with the path MY_FILES:\Documents.

UNC paths

An alias can point to a local drive or a share on a remote server. When you define an alias, you should always use the UNC path and not the mapped drive letter. Mapped drive letters are user-specific in Windows, whereas the UNC path is independent of the user context. This is useful when accessing files from the service under the service user.

Important

Use UNC paths instead of mapped drive letters.

Environment variables

Windows environment variables can be used to define the path of an alias. Percent signs surround variables so they can be identified and substituted when accessing the files. The path %ProgramData%\\demo resolves to C:\ProgramData\demo on a regular English installation of Windows.

Please keep in mind that some environment variables are user-specific, so you need to ensure they have the right value in the service user context.

Configuration

Aliases are defined in the service configuration file.

C:\ProgramData\ForNAV\Direct Print\Configuration\config.json

Here is an example of the part of the configuration that defines the aliases.

…
"FileShares": [
    {
        "Alias": "TEMP",
        "Path": "C:\\Temp"
    },
    {
        "Alias": "DOCUMENTS",
        "Path": "\\\\fileserver01\\public\\documents"
    },
    {
        "Alias": "DEMOFILES",
        "Path": "%programdata%\\ForNAV\\Direct Print\\Demo Files"
    }
]
…

The examples show three aliases.

TEMP points to a local folder on the C drive.

DOCUMENTS points to a folder on a file share.

DEMOFILES shows how you can use environment variables.

Since this is a JSON document, a backslash is written as a double backslash. If you don't encode the backslash with the double backslash, the JSON is invalid, and the configuration is ignored.

File permissions

Windows controls permissions for accessing files and directories. Therefore, your service account must have access to the files, directories, and shares used in the configuration.