mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-05-04 10:33:47 +01:00
refactor: use async version of Path::canonicalize
This commit is contained in:
parent
5c74a3762b
commit
91229d92be
3 changed files with 15 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
||||||
avoid-breaking-exported-api = false
|
avoid-breaking-exported-api = false
|
||||||
disallowed-methods = [
|
disallowed-methods = [
|
||||||
"std::path::Path::exists"
|
"std::path::Path::exists",
|
||||||
|
"std::path::Path::canonicalize",
|
||||||
]
|
]
|
|
@ -193,9 +193,8 @@ impl PublishCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let canonical_package_dir = project
|
let canonical_package_dir = fs::canonicalize(project.package_dir())
|
||||||
.package_dir()
|
.await
|
||||||
.canonicalize()
|
|
||||||
.context("failed to canonicalize package directory")?;
|
.context("failed to canonicalize package directory")?;
|
||||||
|
|
||||||
let mut archive = tokio_tar::Builder::new(
|
let mut archive = tokio_tar::Builder::new(
|
||||||
|
@ -308,8 +307,8 @@ info: otherwise, the file was deemed unnecessary, if you don't understand why, p
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let export_path = export_path
|
let export_path = fs::canonicalize(export_path)
|
||||||
.canonicalize()
|
.await
|
||||||
.with_context(|| format!("failed to canonicalize {name}"))?;
|
.with_context(|| format!("failed to canonicalize {name}"))?;
|
||||||
|
|
||||||
self.validate_luau_file(&format!("file at {name}"), &contents)?;
|
self.validate_luau_file(&format!("file at {name}"), &contents)?;
|
||||||
|
@ -385,8 +384,8 @@ info: otherwise, the file was deemed unnecessary, if you don't understand why, p
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let script_path = script_path
|
let script_path = fs::canonicalize(script_path)
|
||||||
.canonicalize()
|
.await
|
||||||
.with_context(|| format!("failed to canonicalize script {name}"))?;
|
.with_context(|| format!("failed to canonicalize script {name}"))?;
|
||||||
|
|
||||||
self.validate_luau_file(&format!("the `{name}` script"), &contents)?;
|
self.validate_luau_file(&format!("the `{name}` script"), &contents)?;
|
||||||
|
|
|
@ -188,14 +188,13 @@ impl RunCommand {
|
||||||
};
|
};
|
||||||
|
|
||||||
let members = members
|
let members = members
|
||||||
.map(|res| {
|
.then(|res| async {
|
||||||
res.map_err(anyhow::Error::from)?
|
fs::canonicalize(res.map_err(anyhow::Error::from)?.0)
|
||||||
.0
|
.await
|
||||||
.canonicalize()
|
|
||||||
.map_err(anyhow::Error::from)
|
.map_err(anyhow::Error::from)
|
||||||
})
|
})
|
||||||
.chain(futures::stream::once(async {
|
.chain(futures::stream::once(async {
|
||||||
workspace_dir.canonicalize().map_err(Into::into)
|
fs::canonicalize(workspace_dir).await.map_err(Into::into)
|
||||||
}))
|
}))
|
||||||
.try_collect::<HashSet<_>>()
|
.try_collect::<HashSet<_>>()
|
||||||
.await
|
.await
|
||||||
|
@ -204,8 +203,8 @@ impl RunCommand {
|
||||||
let root = 'finder: {
|
let root = 'finder: {
|
||||||
let mut current_path = path.clone();
|
let mut current_path = path.clone();
|
||||||
loop {
|
loop {
|
||||||
let canonical_path = current_path
|
let canonical_path = fs::canonicalize(¤t_path)
|
||||||
.canonicalize()
|
.await
|
||||||
.context("failed to canonicalize parent")?;
|
.context("failed to canonicalize parent")?;
|
||||||
|
|
||||||
if members.contains(&canonical_path)
|
if members.contains(&canonical_path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue