Crash in File Commander when file used (OK) directly after move

Issue #684 resolved
prl created an issue

The GREEN Move command in File Commander uses a Job, and although it refreshes the screen on completion of the action, the job has normally not completed at that time, so the refresh shows the moved file in its old location rather than its new location until the job has completed and the user has refreshed the screen (e.g. with button 0).

If the file is operated on before the refresh, the file doesn't exist in the location indicated in the File Commander file lists. If, say, OK is pressed before the display is refereshed, the UI crashes because of an OSError: [Errno 2] No such file or directory.

Replication steps

Create a small file with a .txt extension by any means (it can be empty).

From live TV, MENU>Sources / Files

Navigate in one panel so that the text file is in the file list, and navigate in the other panel to a different directory on the same device as the text file (so that the move completes quickly).

Navigate to the text file, GREEN Move, Yes. In the file lists, the file will appear not to have moved.

Without any other actions, press OK. Crash.

Comments (1)

  1. Peter Urbanec

    Fix bug #684: Crash in File Commander when file used (OK) directly after move

    Test for the existence of files when they are directly used in system calls, and display a popup if the file is in the FileList but doesn't exist in the file system.

    Also clean up code and error handling in addons.key_actions.onFileAction() in the fallback case where Scanner is used to to try to find a handler for the file type - in guess_type() pass the full file path and not just the filename, and use the already-calculated file path to pass to the scanner instead of re-creating it. In the error handling display the error popup if openFile() returns False as well as when there's a TypeError in openFile.

    → <<cset a8bd6a90db13>>

  2. Log in to comment