euantorano / progress.nim

A simple progress bar for Nim.

Home Page:http://www.euantorano.co.uk/project/progress.nim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sometimes i get newlines on every update

faulander opened this issue · comments

image

Running on Windows 10, 64bit with Nim 1.2.0

Code:

for dir in walkDirRec(sourceDir, yieldFilter={pcDir}): #traverse all dirs in source path
  var amountOfFilesInDir = countFiles(dir, @[".jpg", ".jpeg"])
  var bar = newProgressBar(amountOfFilesInDir)
  echo "Processing Directory ", dir, " with ", intToStr(amountOfFilesInDir), " files."
  bar.start()
  for file in walkDirRec(dir, yieldFilter={pcFile}): # traverse all files in dir
    deleted = delUnwantedFiles(file)
    if (find(toLower(file), ".jpg") > 0 or find(toLower(file), ".jpeg") > 0) and deleted == false:
      #var details = getFileDetails(file)
      var resultOfResize = resizeImage(file, 60)
      bar.increment()
  bar.finish()

I checked the sourcecode and couldn't find the issue. It might be the flush command not correctly working on windows. i'll try and run it on a *nix shell and give you feedback.

I created a pull requests with a fix that works for me on windows AND Linux.

Thanks, I'll test today to make sure it works for me, then merge and tag a new release.