Skip to content
FutureBlitz

    Install

    Import std.os.folders

    std.os.folders

    Folders, where the OS keeps the user's things and the program's, each where that OS's own apps keep them; and OpenDefault, which opens a file, a folder, or a URL in the app the OS opens it with.

    std/os/folders.fb

    Types

    Folders struct

    Public Struct Folders

    Folders' Static Properties, each a folder's path, or Null when the OS doesn't say.

    std/os/folders.fb, line 22

    • Public Static Property Executable: String? property #

      The program's own file.

    • Public Static Property Home: String? property #

      The user's home folder.

    • Public Static Property Config: String? property #

      Where programs keep the user's settings: Windows' roaming AppData, macOS's ~/Library/Application Support, or Linux's XDG_CONFIG_HOME, ~/.config by default. A program keeps its own in a folder of its name there.

    • Public Static Property Data: String? property #

      Where programs keep the user's data: Windows' roaming AppData, macOS's ~/Library/Application Support, or Linux's XDG_DATA_HOME, ~/.local/share by default.

    • Public Static Property Cache: String? property #

      Where programs keep what they can make again: Windows' local AppData, macOS's ~/Library/Caches, or Linux's XDG_CACHE_HOME, ~/.cache by default.

    • Public Static Property Temp: String? property #

      Where programs keep files for a while: the first of TMPDIR, TMP, TEMP, and TEMPDIR that's set, or /tmp, on Linux and macOS, and of TMP, TEMP, and USERPROFILE, or the Windows folder, on Windows.

    • Public Static Property Documents: String? property #

      The user's documents: Windows' Documents, macOS's ~/Documents, or the one Linux's user-dirs.dirs names, ~/Documents by default.

    Functions

    OpenDefault function

    Public Function OpenDefault(target: String) Throws IOError

    Opens target, a file, a folder, or a URL like "https://futureblitz.dev", in the app the OS opens it with, and returns once the OS has taken it. Throws an IOError when target is neither a URL nor a file or folder that's there (NOT_FOUND), when the program may not open it (PERMISSION_DENIED), or when no app opens it (OTHER).

    std/os/folders.fb, line 74

    Report an issue with this page or with FutureBlitz on GitHub.