Next: Version information, Previous: Logging functions, Up: Core API Reference [Contents][Index]

### 2.7 System information

To use the functions described in this section, you will need to load the `(lepton os)` module.

This section describes some functions and variables that are useful for Scheme code that needs to behave differently depending on which operating system Lepton is running on.

Variable: separator-char

  The directory separator character that should be used on the host platform.

  The `separator-char` function is deprecated and must not be used in the newly written code. It will be removed after version 1.10. There is no replacement for it.

Variable: separator

  A string containing `separator-char`.

  The `separator` function is deprecated and must not be used in the newly written code. It will be removed after version 1.10. Use the guile function `file-name-separator-string` instead.

Variable: path-separator-char

  The character used for separating the elements in ‘`PATH`’-like environment variables on the host platform.

Variable: path-separator

  A string containing `path-separator-char`.

Function: platform

  Returns a list of symbols describing the host platform. The returned symbols may include:

  - ‘`cygwin`’
  - ‘`linux`’
  - ‘`win32`’
  - ‘`win32-native`’
  - ‘`unknown`’

  > Note: Previously, the function defined platform on Mac OS as ‘`carbon`’. Since the Carbon framework has been discontinued by Apple, the symbol is no longer used, and the platform will be determined as ‘`unknown`’. The Guile variable %host-type can be used instead to define the platform in this case. For example:

  >     (string-contains %host-type "apple")

  > Please let us know if you have a better suggestion of how to name the platform in the function.

Function: platform? type

  Returns ‘`#t`’ if the platform description list returned by `platform` contains the symbol type, and ‘`#f`’ otherwise.

Function: sys-data-dirs

  Returns an ordered list of directories in which to access system-wide Lepton data.

Function: sys-config-dirs

  Returns an ordered list of directories in which to access system-wide Lepton configuration information.

Function: user-data-dir

  Returns the directory in which to store user-specific Lepton data.

Function: user-config-dir

  Returns the directory in which to store user-specific Lepton configuration information.

Function: user-cache-dir

  Returns the directory in which to store program-specific Lepton configuration information.

Function: expand-env-variables str

  Recursively expands str until no more environment variables can be expanded, and return the expanded string. Environment variables are in the form ‘`${VAR}`’.

      (expand-env-variables "${HOME}/path/to/dir")

Next: Version information, Previous: Logging functions, Up: Core API Reference [Contents][Index]