What it does
path_utils
Path manipulation helpers for the desktop shell's virtual filesystem paths. Stateless string utilities — no engine calls, no module state.
Exports
M.normalizePath(path: string?) -> string— ensure a leading/, strip the trailing/(except for root).nil/empty inputs collapse to"/".M.joinPath(basePath: string, segment: string?) -> string— appendsegmentto a normalised base with a single/separator. Empty segment returns the normalised base.M.parentPath(path: string) -> string— return the parent directory;"/"is its own parent.
Usage
local PathUtils = require("@builtin::modules.path_utils")
PathUtils.normalizePath("apps/") -- "/apps"
PathUtils.joinPath("/home", "player") -- "/home/player"
PathUtils.parentPath("/home/player/saves") -- "/home/player"
Notes
- Pure functions — no side effects, safe to call at module load time.
- These helpers only normalise the desktop VFS path shape; they don't
validate that the path exists in
DesktopConfig.VFS.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.