Sidebar

Home



Expressions V4


Tutorials

How-To

Reference

  Lexical basics
  Type system
  Variables and assignment
  Operators
  Expression rules
  Control flow
  Functions
  Built-in functions
   None and NaN
   Arithmetic
   Algebra
   Logarithmic and Exponential
   Trigonometric
   Rounding and Centering
   Strings
   Output, Formatting, Clipboard, and Errors
   Dialog Functions
   Platform and Paths
  Methods and properties
  Built-in methods
   Common Value Methods
   Number Methods
   String Basic Methods
   String Slice Methods
   String Parsing Methods
   String Formatting Methods
   String Regex Methods
   String Trim and Case Methods
  Objects
  Built-in objects
   Global objects
    settings
    controller
    session
    python
   Collections
    array
    map
    bytes
   File Format I/O
    image_data
    image_stream
   Utils
    crypto
    timer
   Comm
    serial
   Dialogs
    file_open
    file_save
    msg_ok
    msg_ok_cancel
    msg_yes_no
    msg_password
   GUI objects
    window
    panel
    group
    splitpanel
    label
    textbutton
    drawablebutton
    togglebutton
    togglegroup
    textinput
    textedit
    numinput
    slider
    combobox
    listbox
    progressbar
    led
    separator
    menu
    image
    snake
  Classes and user-defined objects
  Include system
  Error model
  Execution model and sessions
  Host integration
  Limits and performance
  Formal reference
  Glossary

Cookbook

exprv4:reference:functions:platform_paths

Platform and Path Functions

These functions inspect the host platform or resolve paths through the same host path rules used by Expr file operations.

path()

Returns the current profile path.

The profile path is the main machine configuration folder. It is the folder where the settings file is stored.

Argument Type Description
none No arguments.

Returns: string.

Example:

profilePath = path();

path(relativePath)

Resolves a path through the host path rules.

Argument Type Description
`relativePath` any Path text to resolve.

Returns: string.

Resolution rules:

  • `path(“”)` returns the source path.
  • `path(“.”)` returns the profile path.
  • `path(“~”)` returns the source file. If there is no source file, it returns an empty string.
  • A path that starts with `~/` is resolved from the source path.
  • A path that starts with `.` is resolved from the profile path.
  • A path that does not start with `.` is resolved from the source path.

Examples:

profilePath = path();
sourcePath = path("");
sourceFile = path("~");
profileFile = path("./MyFile.txt");
sourceFile2 = path("MyFile.txt");
sourceFile3 = path("~/MyFile.txt");
sourceParentFile = path("~/../MyFile.txt");
noSourceFile = path("~"); // empty string when no source file is available

See How relative paths work.

platform()

Returns a string identifying the platform.

Argument Type Description
none No arguments.

Returns: string: `windows`, `linux`, `apple`, `arm`, or `unknown`.

Example:

if(platform() == 'windows')
{
    print('Running on Windows');
};

Previous: Dialog Functions

Next: Methods and properties

exprv4/reference/functions/platform_paths.txt · Last modified: by 127.0.0.1

Page Tools