bwbox/lib/utils.nim

25 lines
555 B
Nim
Raw Normal View History

2021-06-19 16:33:47 +02:00
import os
import args
const APP_NAME = "bwsandbox"
proc getDataDir*(): string =
getEnv("XDG_DATA_DIR", getHomeDir().joinPath(".local/share"))
proc checkRelativePath*(p: string): string =
if p[0] == '/':
return p
getHomeDir().joinPath(p)
proc getProfilePath*(profile: string): string =
getConfigDir()
.joinPath(APP_NAME)
.joinPath(profile)
2021-06-20 14:09:30 +02:00
proc getProfilePath*(args: Args): string =
getProfilePath(args.getProfile())
2021-06-19 16:33:47 +02:00
proc getSandboxPath*(name: string): string =
getDataDir()
.joinPath(APP_NAME)
.joinPath(name)