Skip to content

Avoid file recreation to preserve metadata#1405

Merged
cyanzhong merged 1 commit intomainfrom
develop
May 1, 2026
Merged

Avoid file recreation to preserve metadata#1405
cyanzhong merged 1 commit intomainfrom
develop

Conversation

@cyanzhong
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the native createFile implementation in MarkEditKit’s editor bridge to avoid recreating files on overwrite, preserving existing filesystem metadata (e.g., inode/xattrs) when updating file contents.

Changes:

  • Track file existence/directory status once and remove existing directories when overwrites is enabled.
  • Write new files atomically on first creation, but overwrite existing files in-place via FileHandle to preserve metadata.
  • Add small private extensions for FileManager.fileExists(at:) and Data.overwrite(to:).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MarkEditKit/Sources/Bridge/Native/Modules/EditorModuleAPI.swift Outdated
Comment thread MarkEditKit/Sources/Bridge/Native/Modules/EditorModuleAPI.swift
@cyanzhong cyanzhong merged commit 50414f2 into main May 1, 2026
1 check passed
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.

2 participants