Repository navigation
test(desktop): pin autosave's recreate-missing-directory behavior (#3509) - #4657
Merged
Merged
Conversation
Member
Author
|
Closing without merging. After review we've decided to keep the current behavior: on save (including autosave), MarkText recreates the directory tree and writes the file, rather than failing when the parent folder was moved/deleted. This is consistent with VS Code, which also recreates a deleted parent directory when you save an open file. The priority for (auto)save is to never silently lose the user's edits. See #3509 for the full rationale. |
Jocs
force-pushed
the
fix/issue-3509-autosave-no-recreate-dir
branch
from
June 23, 2026 10:55
b72932a to
3ca9910
Compare
1 task done
) When a file's folder is moved/deleted while it is open, saving recreates the directory tree and writes the file (fs-extra `outputFile`), matching VS Code so an (auto)save never silently fails. This is intentional but was untested — add unit coverage and a comment documenting the rationale so it isn't mistaken for a bug and "fixed" by switching to a plain write. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Jocs
force-pushed
the
fix/issue-3509-autosave-no-recreate-dir
branch
from
June 23, 2026 12:58
3ca9910 to
a294193
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re: #3509 — autosave "re-creates files and folders when they are moved away".
After review we decided this behavior is intentional and correct: when a file's parent folder has been moved or deleted while the file is open, saving (including autosave) recreates the directory tree and writes the file, rather than failing. This matches VS Code, which also recreates a deleted parent directory on save, and it ensures an (auto)save never silently fails or loses the user's edits.
This PR therefore makes no behavior change. It just:
writeFilerecreates a missing parent directory and writes the file; and writes normally when the directory exists).outputFilecall documenting why it's used, so the behavior isn't mistaken for the bug in autosave re-creates files and folders when they are moved away #3509 and "fixed" by switching to a plain write.Test
Both cases pass; typecheck clean.
🤖 Generated with Claude Code