This commit is contained in:
sxyazi 2023-07-27 10:19:02 +08:00
parent b0771e4994
commit 93289284f8
No known key found for this signature in database

View file

@ -180,20 +180,20 @@ impl Manager {
if let Ok(name) = result.await {
let path = cwd.join(&name);
let hovered = path.components().take(cwd.components().count() + 1).collect::<PathBuf>();
if name.ends_with('/') {
fs::create_dir_all(&path).await?;
fs::create_dir_all(path).await?;
} else {
fs::create_dir_all(path.parent().unwrap()).await?;
fs::File::create(&path).await.ok();
fs::create_dir_all(path.parent().unwrap()).await.ok();
fs::File::create(path).await?;
}
let path = path.components().take(cwd.components().count() + 1).collect::<PathBuf>();
if let Ok(file) = File::from(&path).await {
if let Ok(file) = File::from(&hovered).await {
emit!(Hover(file));
}
emit!(Refresh);
}
}
Ok::<(), Error>(())
});
false