DCS World Typescript
    Preparing search index...
    interface l_lfs {
        add_location(name: string, path: string): void;
        attributes(path: string): LfsAttributes | undefined;
        attributes<K extends keyof LfsAttributes>(
            path: string,
            field: K,
        ): LfsAttributes[K] | undefined;
        chdir(path: string): LuaMultiReturn<[true] | [undefined, string]>;
        create_lockfile(...arguments_: unknown[]): unknown;
        currentdir(): string;
        del_location(identifier: unknown): unknown;
        dir(path: string): LuaIterable<string>;
        locations(): LfsLocation[];
        md5sum(path: string): string | undefined;
        mkdir(path: string): LuaMultiReturn<[true] | [undefined, string]>;
        normpath(path: string): string;
        realpath(path: string): string;
        rmdir(path: string): LuaMultiReturn<[true] | [undefined, string]>;
        tempdir(): string;
        writedir(): string;
    }

    Hierarchy

    • Omit<
          _lfs,
          | "add_location"
          | "attributes"
          | "chdir"
          | "create_lockfile"
          | "currentdir"
          | "del_location"
          | "dir"
          | "locations"
          | "md5sum"
          | "mkdir"
          | "normpath"
          | "realpath"
          | "rmdir"
          | "tempdir"
          | "writedir",
      >
      • l_lfs
    Index
    • Adds a named file-dialog location.

      Parameters

      • name: string
      • path: string

      Returns void

      `lfs.add_location("My Missions", `${lfs.writedir()}Missions\`);`
      

      %DCS_INSTALL_DIR%/Scripts/UserFiles.lua:31

    • Metadata returned by attributes; see LfsAttributes.

      Parameters

      • path: string

      Returns LfsAttributes | undefined

    • Returns one named metadata field, or undefined when the path does not exist.

      Type Parameters

      Parameters

      • path: string
      • field: K

      Returns LfsAttributes[K] | undefined

      `const mode = lfs.attributes(fileName, "mode");`
      

      %DCS_INSTALL_DIR%/MissionEditor/modules/FileDialogUtils.lua:121

    • Changes the process working directory.

      Parameters

      • path: string

      Returns LuaMultiReturn<[true] | [undefined, string]>

      true on success, otherwise undefined and an error string.

      `const [ok, error] = lfs.chdir(lfs.writedir());`
      
    • TODO: DCS exports this native lock helper but the installed public API and Lua sources do not expose its argument or return contract.

      Parameters

      • ...arguments_: unknown[]

      Returns unknown

    • Returns the current DCS installation directory.

      Returns string

      DCS installation directory with a trailing path separator.

      const installDirectory = lfs.currentdir();
      
    • TODO: DCS exports this native function but installed Lua scripts contain no callsite proving whether deletion is keyed by display name or path.

      Parameters

      • identifier: unknown

      Returns unknown

      %DCS_INSTALL_DIR%/Scripts/UserFiles.lua

    • Iterates entry names in a directory, including . and ...

      Parameters

      • path: string

      Returns LuaIterable<string>

      `for (const name of lfs.dir(lfs.writedir())) { log.info("%s", name); }`
      

      %DCS_INSTALL_DIR%/MissionEditor/modules/FileDialogUtils.lua:118

    • Returns configured file-dialog locations.

      Returns LfsLocation[]

      `const missionFolders = lfs.locations();`
      

      %DCS_INSTALL_DIR%/Scripts/UserFiles.lua:16

    • Computes the MD5 digest of a file.

      Parameters

      • path: string

      Returns string | undefined

      Lower-case hexadecimal digest, or undefined when the file cannot be read.

      `const digest = lfs.md5sum(fileName);`
      
    • Creates one directory level.

      Parameters

      • path: string

      Returns LuaMultiReturn<[true] | [undefined, string]>

      true on success, otherwise undefined plus an error.

      `const [ok] = lfs.mkdir(`${lfs.tempdir()}my-mod`);`
      

      %DCS_INSTALL_DIR%/MissionEditor/MissionEditor.lua:172

    • Normalizes separators and ./.. path segments.

      Parameters

      • path: string

      Returns string

      `const path = lfs.normpath("Scripts/../Scripts");`
      

      %DCS_INSTALL_DIR%/API/Sim_ControlAPI.md:90

    • Resolves a relative path against the current directory without requiring it to exist.

      Parameters

      • path: string

      Returns string

      `const path = lfs.realpath("Scripts");`
      

      %DCS_INSTALL_DIR%/MissionEditor/modules/FileDialogUtils.lua:178

    • Removes an empty directory.

      Parameters

      • path: string

      Returns LuaMultiReturn<[true] | [undefined, string]>

      true on success, otherwise undefined plus an error.

      `const [ok] = lfs.rmdir(`${lfs.tempdir()}my-mod`);`
      

      %DCS_INSTALL_DIR%/MissionEditor/modules/me_mission.lua:8609

    • Returns the current temp write directory.

      Returns string

      DCS-specific temporary directory with a trailing path separator.

      const temporaryDirectory = lfs.tempdir();
      
    • Returns the current write directory.

      Returns string

      Current DCS Saved Games directory with a trailing path separator.

      const logPath = `${lfs.writedir()}Logs\\my-export.log`;