Compare commits

..

No commits in common. "main" and "1.0.13" have entirely different histories.
main ... 1.0.13

4 changed files with 17 additions and 11 deletions

View File

@ -1 +0,0 @@
nim 1.6.20

View File

@ -1 +1 @@
const PTK_VERSION* = "1.0.14" const PTK_VERSION* = "1.0.13"

23
ptk.nim
View File

@ -307,21 +307,28 @@ Options:
quit() quit()
# Find and parse the .ptkrc file # Find and parse the .ptkrc file
let ptkrcLocations = let ptkrcLocations = @[
if args["--config"]: @[$args["--config"]] if args["--config"]: $args["--config"] else:"",
else: @[".ptkrc", $getEnv("PTKRC"), $getEnv("HOME") & "/.ptkrc"] ".ptkrc", $getEnv("PTKRC"), $getEnv("HOME") & "/.ptkrc"]
let foundPtkrcLocations = var ptkrcFilename: string =
ptkrcLocations.filterIt(it.len > 0 and fileExists(it)) foldl(ptkrcLocations, if len(a) > 0: a elif fileExists(b): b else: "")
var cfg: JsonNode var cfg: JsonNode
if foundPtkrcLocations.len < 1: var cfgFile: File
if not fileExists(ptkrcFilename):
warn "ptk: could not find .ptkrc file." warn "ptk: could not find .ptkrc file."
debug "ptk: considered the following locations:\n\t" & ptkrcLocations.join("\n\t") debug "ptk: considered the following locations:\n\t" & ptkrcLocations.join("\n\t")
#ptkrcFilename = $getEnv("HOME") & "/.ptkrc"
#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(foundPtkrcLocations[0]) try: cfg = parseFile(ptkrcFilename)
except: raise newException(IOError, except: raise newException(IOError,
"unable to read config file: " & foundPtkrcLocations[0] & "unable to read config file: " & ptkrcFilename &
"\x0D\x0A" & getCurrentExceptionMsg()) "\x0D\x0A" & getCurrentExceptionMsg())
# Find the time log file # Find the time log file

View File

@ -1,6 +1,6 @@
# Package # Package
version = "1.0.14" version = "1.0.13"
author = "Jonathan Bernard" author = "Jonathan Bernard"
description = "Personal Time Keeper" description = "Personal Time Keeper"
license = "MIT" license = "MIT"