rename directory entries
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::time::UNIX_EPOCH;
|
||||
|
||||
use anyhow::{Context, anyhow};
|
||||
use anyhow::{Context, anyhow, bail};
|
||||
use tokio::{fs, io::AsyncWriteExt as _};
|
||||
|
||||
use crate::domain::warren::{
|
||||
@@ -156,6 +156,10 @@ impl FileSystem {
|
||||
FilePath::new(&c)?
|
||||
};
|
||||
|
||||
if fs::try_exists(&new_path).await? {
|
||||
bail!("File already exists");
|
||||
}
|
||||
|
||||
fs::rename(current_path, &new_path).await?;
|
||||
|
||||
Ok(new_path)
|
||||
|
||||
Reference in New Issue
Block a user