diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-19 21:21:18 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-19 21:21:18 +0100 |
commit | b2873fdc765e92aca4267e60c65a5da4897a04a0 (patch) | |
tree | f2d2a570a3cb27eafeaa0431604ea4b9d3a1a96a /src/config | |
parent | 87c918062d4666837b1afafa9094e0e5b7ba57d6 (diff) | |
download | chawan-b2873fdc765e92aca4267e60c65a5da4897a04a0.tar.gz |
main: set CHA_LIBEXEC_DIR env var at startup
This way, we can use it everywhere (e.g. in mailcap).
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/config.nim | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/config/config.nim b/src/config/config.nim index 23762c02..b22b532e 100644 --- a/src/config/config.nim +++ b/src/config/config.nim @@ -595,6 +595,10 @@ proc parseConfigValue(ctx: var ConfigParser; x: var MimeTypes; v: TomlValue; if f != nil: x.parseMimeTypes(f) +const DefaultMailcap = block: + let ss = newStringStream(staticRead"res/mailcap") + parseMailcap(ss).get + proc parseConfigValue(ctx: var ConfigParser; x: var Mailcap; v: TomlValue; k: string) = var paths: seq[ChaPathResolved] @@ -608,21 +612,7 @@ proc parseConfigValue(ctx: var ConfigParser; x: var Mailcap; v: TomlValue; x.add(res.get) else: ctx.warnings.add("Error reading mailcap: " & res.error) - template uq(s: string): string = - ChaPath(s).unquote.get - let defaultCmds = { - "gopher": "${%CHA_LIBEXEC_DIR}/gopher2html -u \\$MAILCAP_URL".uq, - "gemini": "${%CHA_LIBEXEC_DIR}/gmi2html".uq, - "markdown": "${%CHA_LIBEXEC_DIR}/md2html".uq, - "x-ansi":"${%CHA_LIBEXEC_DIR}/ansi2html".uq - } - for (subt, cmd) in defaultCmds: - x.add(MailcapEntry( - mt: "text", - subt: subt, - cmd: cmd, - flags: {HTMLOUTPUT} - )) + x.add(DefaultMailcap) const DefaultURIMethodMap = parseURIMethodMap(staticRead"res/urimethodmap") |