• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • CDP Linux
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - External Value Types
  • External Type Path Resolving
  • 5.1.0

File Handler

External Type Path Resolving

External Type Path Resolving

In many cases, it is necessary to use an external storage (e.g., a database file) that resides outside the application installation directory. However, it is often undesirable to hardcode absolute paths into the application configuration files or code, as this can lead to portability issues and maintenance challenges, as actual paths may be different from controller to controller.

To overcome this, a path resolving using environment variables and OS-specific slices can be used in external type path configurations.

Environment Variables Value Substitution

Environment variable references in the external type paths are replaced with the variable value, similarly to how standard OS environment variables are denoted in the respective OS scripts.

On Linux, these environment variable reference syntaxes can be used:

$ENV_VAR_NAME

or

${ENV_VAR_NAME}

And on Windows, this syntax:

%ENV_VAR_NAME%

Using these references in the paths will cause them to be resolved to the actual values of the respective environment variables at runtime.

Application-specific Environment Variables

Additionally, two application-specific environment variables are always defined by CDP that can also be used in the path resolving:

  • CDP_SYSTEM_NAME - The name of the system the application belongs to.
  • CDP_APPLICATION_NAME - The name of the application.

OS-Specific Path Slices

To accommodate different operating systems with a single configuration, the resolving mechanism also supports OS-specific slices. These slices allow defining different path segments for Linux and Windows within the same path string.

The syntax for OS-specific slices is as follows:

[LINUX:linux_specific_path_segment][WINDOWS:windows_specific_path_segment]

Example Usage

Here are some examples of how to use environment variables and OS-specific slices in external type paths:

ExternalType="SQLiteValue;
 DBLocation=[LINUX:$HOME/.local/$CDP_APPLICATION_NAME:][WINDOWS:%LOCALAPPDATA%\\%CDP_APPLICATION_NAME%:];
 DBName=[LINUX:${CDP_APPLICATION_NAME}:][WINDOWS:%CDP_APPLICATION_NAME%:].db"

In this example, the database location and name is defined differently for Linux and Windows, using the appropriate environment variables for each OS:

  • On Linux, the database will be located in the user's home directory under .local and the application name.
  • On Windows, the database will be located in the LOCALAPPDATA directory under the application name.
  • The database name will be the application name with a .db extension, on both OSes.

Note: Note that the backslash in the Windows path segment has to be escaped (\) to ensure it is interpreted correctly.

File Handler

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2026 CDP Technologies. Privacy and cookie policy.

Return to top