Skip to Content
defold-typescript libraries
Lerg

Lerg/extension-directories/directories

Absolute paths inside the platform's standard directories: application support, caches, documents, resource and temporary.

  • GitHub: Lerg/extension-directories — pinned to 2023870
    1. This repo publishes no releases or tags. Add a commit archive URL — for the pinned commit, https://github.com/Lerg/extension-directories/archive/2023870e8afda0028eec5432852c8f37d7177ecd.zip — to game.project under [project] dependencies, then Fetch Libraries in the Defold editor.
    2. Run bunx @defold-typescript/cli resolve to materialize its types.
    3. Import it under a namespace alias of your choice:
      import * as directories from "directories"

Functions

path_for_file(file_path?: string, directory?: number): string | undefined

Resolves an absolute path for a file inside one of the system directories.

Parameters

  • file_path?: string — The file name, or a path relative to directory. Pass nothing to get the directory itself.
  • directory?: number — The base directory constant. Default is {@link directories.resource}.

Returns

  • string | undefined — The resolved absolute path, or nothing when the directory cannot be created or resolved.

Variables

application_support: number

The platform's application-support directory, for {@link directories.path_for_file}.

caches: number

The platform's directory for cached files, which the OS may clear to free space, for {@link directories.path_for_file}.

documents: number

The platform's directory for the app's private data files, persistent across restarts, for {@link directories.path_for_file}.

resource: number

The app's resource directory, the default base, for {@link directories.path_for_file}.

temporary: number

The platform's directory for temporary files, for {@link directories.path_for_file}.

On this page