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
|
||||
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
|
||||
.package_dir()
|
||||
.canonicalize()
|
||||
let canonical_package_dir = fs::canonicalize(project.package_dir())
|
||||
.await
|
||||
.context("failed to canonicalize package directory")?;
|
||||
|
||||
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
|
||||
.canonicalize()
|
||||
let export_path = fs::canonicalize(export_path)
|
||||
.await
|
||||
.with_context(|| format!("failed to canonicalize {name}"))?;
|
||||
|
||||
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
|
||||
.canonicalize()
|
||||
let script_path = fs::canonicalize(script_path)
|
||||
.await
|
||||
.with_context(|| format!("failed to canonicalize script {name}"))?;
|
||||
|
||||
self.validate_luau_file(&format!("the `{name}` script"), &contents)?;
|
||||
|
|
|
@ -188,14 +188,13 @@ impl RunCommand {
|
|||
};
|
||||
|
||||
let members = members
|
||||
.map(|res| {
|
||||
res.map_err(anyhow::Error::from)?
|
||||
.0
|
||||
.canonicalize()
|
||||
.then(|res| async {
|
||||
fs::canonicalize(res.map_err(anyhow::Error::from)?.0)
|
||||
.await
|
||||
.map_err(anyhow::Error::from)
|
||||
})
|
||||
.chain(futures::stream::once(async {
|
||||
workspace_dir.canonicalize().map_err(Into::into)
|
||||
fs::canonicalize(workspace_dir).await.map_err(Into::into)
|
||||
}))
|
||||
.try_collect::<HashSet<_>>()
|
||||
.await
|
||||
|
@ -204,8 +203,8 @@ impl RunCommand {
|
|||
let root = 'finder: {
|
||||
let mut current_path = path.clone();
|
||||
loop {
|
||||
let canonical_path = current_path
|
||||
.canonicalize()
|
||||
let canonical_path = fs::canonicalize(¤t_path)
|
||||
.await
|
||||
.context("failed to canonicalize parent")?;
|
||||
|
||||
if members.contains(&canonical_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue