0126653047cf73f6ae0fe36a3db2027287e98381 — Thomas Landin a month ago 2d6ba24
Fix bug in using the try statement

I was relying on a buggy behaviour of the try statement to assign a
value. Both the try and except path need to return the same type of
value, but I was exiting the program in the except:

This satisfies the compiler though and fixes that bug.
1 files changed, 3 insertions(+), 2 deletions(-)

M src/dtt.nim
M src/dtt.nim => src/dtt.nim +3 -2
@@ 76,8 76,9 @@ proc initCmd(dir: string, force: bool = false) =
  setFilePermissions(wd / output_dir / css_dir / "style.css", outFilePerms)

proc buildCmd(posts_per_page: int = 5) =
  let working_dir = try:
  var working_dir: string
    working_dir = findBaseDir(os.getCurrentDir())
  except IOError:
    stderr.writeLine(fmt"{bin}: Could not find a content folder. Is this a dtt directory?")