BoraxTheClean / adaptable-antelopes

Code Jam 2021 adaptable antelopes team
MIT License
1 stars 0 forks source link

Attempting to save file to nonexistent directory in .thought_box breaks application #63

Closed ghost closed 3 years ago

ghost commented 3 years ago

Trying to save a file to a directory that does not exist in .thought_box (e.g., nonexistent/.file.txt) triggers the popup [Errno 2: No such file or directory : '<directory-name>'. After closing the app, restarting triggers the same error because editor.py tries to read the nonexistent path when the ThoughtBox instance is created. I don't know how to reset the application state when this happens.

Recommended fixes:

  1. In save_file_as_path, add a condition verifying the dirname of the user's entered path either exists or is the empty string (for a file saved at the top level in .thought_box.
  2. Add an error handler to ThoughtBox's __init__ to display an empty file if self.application_state.current_path can't be read.
SharpBit commented 3 years ago

Should be fixed in f71ae3f788287eac8893977350f73bb90f3b8176, now it only updates current path if the Save As was successful.