Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
c00be8c1fc | |||
96ee649bf6 | |||
69177ffa17 |
1
.tool-versions
Normal file
1
.tool-versions
Normal file
@ -0,0 +1 @@
|
|||||||
|
nim 1.6.20
|
@ -1 +1 @@
|
|||||||
const PTK_VERSION* = "1.0.12"
|
const PTK_VERSION* = "1.0.14"
|
24
ptk.nim
24
ptk.nim
@ -307,27 +307,21 @@ Options:
|
|||||||
quit()
|
quit()
|
||||||
|
|
||||||
# Find and parse the .ptkrc file
|
# Find and parse the .ptkrc file
|
||||||
let ptkrcLocations = @[
|
let ptkrcLocations =
|
||||||
if args["--config"]: $args["--config"] else:"",
|
if args["--config"]: @[$args["--config"]]
|
||||||
".ptkrc", $getEnv("PTKRC"), $getEnv("HOME") & "/.ptkrc"]
|
else: @[".ptkrc", $getEnv("PTKRC"), $getEnv("HOME") & "/.ptkrc"]
|
||||||
|
|
||||||
var ptkrcFilename: string =
|
let foundPtkrcLocations =
|
||||||
foldl(ptkrcLocations, if len(a) > 0: a elif fileExists(b): b else: "")
|
ptkrcLocations.filterIt(it.len > 0 and fileExists(it))
|
||||||
|
|
||||||
var cfg: JsonNode
|
var cfg: JsonNode
|
||||||
var cfgFile: File
|
if foundPtkrcLocations.len < 1:
|
||||||
if not fileExists(ptkrcFilename):
|
|
||||||
warn "ptk: could not find .ptkrc file."
|
warn "ptk: could not find .ptkrc file."
|
||||||
ptkrcFilename = $getEnv("HOME") & "/.ptkrc"
|
debug "ptk: considered the following locations:\n\t" & ptkrcLocations.join("\n\t")
|
||||||
try:
|
|
||||||
cfgFile = open(ptkrcFilename, fmWrite)
|
|
||||||
cfgFile.write("{\"timelineLogFile\": \"timeline.log.json\"}")
|
|
||||||
except: warn "ptk: could not write default .ptkrc to " & ptkrcFilename
|
|
||||||
finally: close(cfgFile)
|
|
||||||
|
|
||||||
try: cfg = parseFile(ptkrcFilename)
|
try: cfg = parseFile(foundPtkrcLocations[0])
|
||||||
except: raise newException(IOError,
|
except: raise newException(IOError,
|
||||||
"unable to read config file: " & ptkrcFilename &
|
"unable to read config file: " & foundPtkrcLocations[0] &
|
||||||
"\x0D\x0A" & getCurrentExceptionMsg())
|
"\x0D\x0A" & getCurrentExceptionMsg())
|
||||||
|
|
||||||
# Find the time log file
|
# Find the time log file
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "1.0.12"
|
version = "1.0.14"
|
||||||
author = "Jonathan Bernard"
|
author = "Jonathan Bernard"
|
||||||
description = "Personal Time Keeper"
|
description = "Personal Time Keeper"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user