Skip to content

autosave re-creates files and folders when they are moved away #3509

Closed as not planned

Description

@pogoba

Description

  • Can you reproduce the issue?

Steps to reproduce

  1. open a file in marktext while autosave is on
  2. move that file/its parent folder somewhere else
  3. edit the file in marktext and wait for a save
  4. discover, marktext recreated the folder and autosaved the file into it

Expected behavior:

From a developers perspective this is nice behaviour - a user expects a warning, that autosave had to recreate a file/folder. Otherwise he will be confused, why the old folder keeps reappearing and why files in the moved folder are not updated.

Versions

  • MarkText version: v0.17.1
  • Operating system: NixOS

Activity

  1. added
    🐛 bug
    🪲 pri/major
    on May 16, 2026
  2. Jocs commented on Jun 23, 2026

    @Jocs
    Member

    Thanks for the detailed report.

    After review, we've decided to keep MarkText's current behavior: 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 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 fail or lose the user's edits — failing the save when the folder is gone would risk data loss and, arguably, more confusion.

    We considered surfacing a warning when a directory had to be recreated, but opted to stay consistent with the common editor behavior (just save, no prompt) to keep autosave unobtrusive.

    To make sure this stays intentional and isn't mistaken for a bug later, we've added unit coverage and an inline note documenting the rationale: #4657.

    Closing as working-as-intended. If you'd like an explicit "directory was recreated" notification, that would be a welcome separate feature request. Thanks again!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    🪲 pri/major🐛 bug🔭 area/editor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions