diff --git a/clippy.toml b/clippy.toml index 1f754d0..4b3530e 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,4 +1,5 @@ avoid-breaking-exported-api = false disallowed-methods = [ - "std::path::Path::exists" -] \ No newline at end of file + "std::path::Path::exists", + "std::path::Path::canonicalize", +] diff --git a/src/cli/commands/publish.rs b/src/cli/commands/publish.rs index 24d5f2c..ee9c36c 100644 --- a/src/cli/commands/publish.rs +++ b/src/cli/commands/publish.rs @@ -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)?; diff --git a/src/cli/commands/run.rs b/src/cli/commands/run.rs index a46388f..0cd6924 100644 --- a/src/cli/commands/run.rs +++ b/src/cli/commands/run.rs @@ -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::>() .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)