SplitScript reference / Module / path

Module.path

Method

Module.path() -> String!

Returns the module's host-provided filesystem path.

The returned value is an absolute path in the runtime's portable, read-only filesystem namespace. Windows paths map by drive, so C:\Games\engine.dll becomes /mnt/c/Games/engine.dll. Linux and macOS paths gain the /mnt prefix, so /opt/game/engine.so becomes /mnt/opt/game/engine.so. It can be passed directly to File.readAllBytes or File.readAllText.

Effects: reads process memory, requires an attached process

Runtime behavior: available while a process is attached, except in onDetach; synchronous

Examples

Inspect the executable path

let executable = await process.mainModule()
let path = executable.path() else "Unknown"