Skip to content

Fix silent save failure when file write is denied#3

Open
srfwb wants to merge 1 commit into
AlexHettle:mainfrom
srfwb:fix/silent-save-failure
Open

Fix silent save failure when file write is denied#3
srfwb wants to merge 1 commit into
AlexHettle:mainfrom
srfwb:fix/silent-save-failure

Conversation

@srfwb
Copy link
Copy Markdown

@srfwb srfwb commented May 11, 2026

Summary

Fixes #2 — MeadowPy silently fails when saving a file it doesn't have write permission to. The unsaved dot disappears even though nothing was written to disk.

What changed

  • file_manager.py: save_file() now shows a QMessageBox.critical error dialog when the write fails (same style as existing error dialogs in file_explorer.py)
  • workspace_controller.py: action_save() now checks the return value of save_file() — the modified flag and tab title are only updated on success

Impact

All save paths that go through action_save() are fixed:

  • Ctrl+S / toolbar / menu Save
  • Save-before-Run (F5)
  • Save-before-Debug
  • Save on tab close
  • Save on app exit

Save As was already handling failure correctly.

After fix

  • Set a .py file to read-only, open it, edit it, press Ctrl+S — error dialog should appear and the dot should remain
  • Save a normal file — should work as before, dot disappears, status bar shows "Saved"

@AlexHettle
Copy link
Copy Markdown
Owner

Thanks for getting on this right away! I haven't been able to test this one yet myself, but from running the test suite it looks like it hangs on the file_manager tests and doesn't complete it's testing run, which makes me worried there's an issue worse than just non-updated tests:

image

Like I mentioned on the last code review I made, just make sure you're keeping the test suite in mind when making changes, I'll circle back and check this again once you've looked into this. Once again thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not showing Permission Denied Error

2 participants