Log locations when unable to load config.
When we can't find a config file, log all the locations we looked and don't create a new file in $HOME/.ptkrc. There is currently an intermittent bug in the config loading logic that is leading to the default config file in $HOME/.ptkrc not being found and then being overwritten with the default config. This is step one in fixing it.
This commit is contained in:
		@@ -1 +1 @@
 | 
			
		||||
const PTK_VERSION* = "1.0.12"
 | 
			
		||||
const PTK_VERSION* = "1.0.13"
 | 
			
		||||
							
								
								
									
										13
									
								
								ptk.nim
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								ptk.nim
									
									
									
									
									
								
							@@ -318,12 +318,13 @@ Options:
 | 
			
		||||
  var cfgFile: File
 | 
			
		||||
  if not fileExists(ptkrcFilename):
 | 
			
		||||
    warn "ptk: could not find .ptkrc file."
 | 
			
		||||
    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)
 | 
			
		||||
    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)
 | 
			
		||||
  except: raise newException(IOError,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
# Package
 | 
			
		||||
 | 
			
		||||
version       = "1.0.12"
 | 
			
		||||
version       = "1.0.13"
 | 
			
		||||
author        = "Jonathan Bernard"
 | 
			
		||||
description   = "Personal Time Keeper"
 | 
			
		||||
license       = "MIT"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user