akatch22 / romcollectionbrowser

Automatically exported from code.google.com/p/romcollectionbrowser
GNU General Public License v2.0
0 stars 0 forks source link

Bug in recursive walkdown() function in dbupdate.py #218

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
There is a bug in the recursive implementation of the walkdown() function in 
dbupdate.py that makes maxFolderDepth act like "maxFolderAmount".

Removing the line 
    maxFolderDepth = maxFolderDepth - 1

and calling the walkDown() function like this
    self.walkDown(files, newRomPath, maxFolderDepth - 1)

fixes the issue and has no negative side effects.

Full function:

def walkDown(self, files, romPath, maxFolderDepth):
    Logutil.log("Running walkdown on: %s" %romPath, util.LOG_LEVEL_INFO)
    dirs, newFiles, dirname, filemask = self.getFilesByWildcardExt(romPath)
    files.extend(newFiles)
    for dir in dirs:
        newRomPath = util.joinPath(dirname, dir, filemask)
        if(maxFolderDepth > 0):
            self.walkDown(files, newRomPath, maxFolderDepth - 1)
    return files

Hope you can fix this soon!

Cheers
Alex

Original issue reported on code.google.com by Alexande...@gmail.com on 12 May 2015 at 12:07