mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 09:26:19 +04:00
helix-view:move_path create target directory on move
This commit is contained in:
parent
1b5295a3f3
commit
082791211e
@ -1370,6 +1370,10 @@ pub fn move_path(&mut self, old_path: &Path, new_path: &Path) -> io::Result<()>
|
||||
log::error!("failed to apply workspace edit: {err:?}")
|
||||
}
|
||||
}
|
||||
// Create the target directory if it doesn't exist. fs::rename won't do that implicitly.
|
||||
if let Some(parent) = new_path.parent() {
|
||||
fs::create_dir_all(parent)?;
|
||||
}
|
||||
fs::rename(old_path, &new_path)?;
|
||||
if let Some(doc) = self.document_by_path(old_path) {
|
||||
self.set_doc_path(doc.id(), &new_path);
|
||||
|
Loading…
Reference in New Issue
Block a user