Skip to content

Commit

Permalink
Fix renaming folder (fix #1729)
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Sep 30, 2024
1 parent 6f8bbe7 commit 1a00b43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

### Fixes

- Fix an issue in the file browser that duplicate folders were displayed after renaming a folder.
- Fix an issue in the file browser that some actions for the root folder were incorrectly disabled.
- Fix an issue that changes of insertion formats in the Snippets settings pane were not saved.
- Fix an issue that the initial visibility state of the navigation bar was reversed.
Expand Down
3 changes: 2 additions & 1 deletion CotEditor/Sources/Document/FileNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ extension FileNode {
let keepsHidden = self.isHidden && !self.name.starts(with: ".")

self.name = newName
self.fileURL = self.fileURL.deletingLastPathComponent().appending(path: newName)
self.fileURL = self.fileURL.deletingLastPathComponent()
.appending(path: newName, directoryHint: self.isDirectory ? .isDirectory : .notDirectory)
self.invalidateKind()
if !keepsHidden {
self.isHidden = newName.starts(with: ".")
Expand Down

0 comments on commit 1a00b43

Please sign in to comment.