feat: move also creates parent dir on destination
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
@@ -328,6 +328,14 @@ pub async fn apply(input: &str, options: ApplyOptions) -> anyhow::Result<()> {
|
||||
anyhow::bail!("destination already exists cannot move");
|
||||
}
|
||||
|
||||
if let Some(parent) = existing.path.parent()
|
||||
&& !parent.exists()
|
||||
{
|
||||
tokio::fs::create_dir_all(&parent)
|
||||
.await
|
||||
.context("failed to create dest for move")?;
|
||||
}
|
||||
|
||||
tokio::fs::rename(&existing.path, path)
|
||||
.await
|
||||
.context("move path")?;
|
||||
|
Reference in New Issue
Block a user