Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c00be8c1fc | |||
96ee649bf6 |
1
.tool-versions
Normal file
1
.tool-versions
Normal file
@ -0,0 +1 @@
|
||||
nim 1.6.20
|
@ -1 +1 @@
|
||||
const PTK_VERSION* = "1.0.13"
|
||||
const PTK_VERSION* = "1.0.14"
|
23
ptk.nim
23
ptk.nim
@ -307,28 +307,21 @@ Options:
|
||||
quit()
|
||||
|
||||
# Find and parse the .ptkrc file
|
||||
let ptkrcLocations = @[
|
||||
if args["--config"]: $args["--config"] else:"",
|
||||
".ptkrc", $getEnv("PTKRC"), $getEnv("HOME") & "/.ptkrc"]
|
||||
let ptkrcLocations =
|
||||
if args["--config"]: @[$args["--config"]]
|
||||
else: @[".ptkrc", $getEnv("PTKRC"), $getEnv("HOME") & "/.ptkrc"]
|
||||
|
||||
var ptkrcFilename: string =
|
||||
foldl(ptkrcLocations, if len(a) > 0: a elif fileExists(b): b else: "")
|
||||
let foundPtkrcLocations =
|
||||
ptkrcLocations.filterIt(it.len > 0 and fileExists(it))
|
||||
|
||||
var cfg: JsonNode
|
||||
var cfgFile: File
|
||||
if not fileExists(ptkrcFilename):
|
||||
if foundPtkrcLocations.len < 1:
|
||||
warn "ptk: could not find .ptkrc file."
|
||||
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(ptkrcFilename)
|
||||
try: cfg = parseFile(foundPtkrcLocations[0])
|
||||
except: raise newException(IOError,
|
||||
"unable to read config file: " & ptkrcFilename &
|
||||
"unable to read config file: " & foundPtkrcLocations[0] &
|
||||
"\x0D\x0A" & getCurrentExceptionMsg())
|
||||
|
||||
# Find the time log file
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Package
|
||||
|
||||
version = "1.0.13"
|
||||
version = "1.0.14"
|
||||
author = "Jonathan Bernard"
|
||||
description = "Personal Time Keeper"
|
||||
license = "MIT"
|
||||
|
Loading…
x
Reference in New Issue
Block a user