blawar / nut

GNU General Public License v3.0
1.09k stars 189 forks source link

[Bug] deleted folder crash #444

Open maxmag-soft opened 1 year ago

maxmag-soft commented 1 year ago

Describe the bug This is a bug where the software crash when a folder gets deleted.

To Reproduce Steps to reproduce the behaviour: 1 Run python3 nut_gui.py 2 Scan a folder and get some files listed on the window 3 Delete the folder that have been scanned or other folder inside the folder where files where located 4 close nut_gui and reopen 5 crash:

Traceback (most recent call last):
  File "/media/somefolder/nut/nut_gui.py", line 67, in <module>
    run()
  File "/media/somefolder/nut/nut_gui.py", line 44, in run
    nut.initTitles()
  File "/media/somefolder/nut/nut/__init__.py", line 631, in initTitles
    initFiles(verify=verify)
  File "/media/somefolder/nut/nut/__init__.py", line 641, in initFiles
    Nsps.load(verify=verify)
  File "/media/somefolder/nut/nut/Nsps.py", line 238, in load
    if cache.isfile(path) and not _is_file_hidden(path):
  File "/media/somefolder/nut/nut/Nsps.py", line 208, in isfile
    for f in os.listdir(parent):
FileNotFoundError: [Errno 2] No such file or directory: '/media/somefolder/games/etc'

Actual behaviour Crash the software (Gui and Cli version)

Expected behaviour A clear and concise description of what you expected to happen.

Screenshots

                        ,;:;;,
                       ;;;;;
               .=\',    ;:;;:,
              /_\', "=. \';:;:;
              @=:__,  \,;:;:\'
                _(\.=  ;:;;\'
               `"_(  _/="`
                `"\'
loaded titledb/titles.json in 1.0706207239991272 seconds
Traceback (most recent call last):
  File "/media/somefolder/nut/nut_gui.py", line 67, in <module>
    run()
  File "/media/somefolder/nut/nut_gui.py", line 44, in run
    nut.initTitles()
  File "/media/somefolder/nut/nut/__init__.py", line 631, in initTitles
    initFiles(verify=verify)
  File "/media/somefolder/nut/nut/__init__.py", line 641, in initFiles
    Nsps.load(verify=verify)
  File "/media/somefolder/nut/nut/Nsps.py", line 238, in load
    if cache.isfile(path) and not _is_file_hidden(path):
  File "/media/somefolder/nut/nut/Nsps.py", line 208, in isfile
    for f in os.listdir(parent):
FileNotFoundError: [Errno 2] No such file or directory: '/media/somefolder/games/etc'

NUT version (or git hash):

Additional context To fix that, delete the file .../nut/titledb/files.json then start the application and rescan again

some-git-user commented 10 months ago

@maxmag-soft I will put this in an separate comment to highlight the workaround To fix that, delete the file .../nut/titledb/files.json then start the application and rescan again