diff --git a/src/dependencies/mod.rs b/src/dependencies/mod.rs index a0a1091..831bc6e 100644 --- a/src/dependencies/mod.rs +++ b/src/dependencies/mod.rs @@ -259,7 +259,7 @@ pub enum ConvertManifestsError { #[cfg(feature = "wally")] #[error("error parsing the sourcemap")] Parse(#[from] serde_json::Error), - + /// An error that occurred while writing the manifest #[error("error writing the manifest")] Write(#[from] serde_yaml::Error), @@ -358,8 +358,11 @@ impl Project { .is_some_and(|ext| ext == "lua" || ext == "luau") }) .or_else(|| Some(relative_path::RelativePathBuf::from("true"))); - - serde_yaml::to_writer(&std::fs::File::create(&source.join(crate::MANIFEST_FILE_NAME))?, &manifest)?; + + serde_yaml::to_writer( + &std::fs::File::create(&source.join(crate::MANIFEST_FILE_NAME))?, + &manifest, + )?; } } diff --git a/src/linking_file.rs b/src/linking_file.rs index 80a8eb4..590843c 100644 --- a/src/linking_file.rs +++ b/src/linking_file.rs @@ -1,7 +1,6 @@ use std::{ collections::HashSet, fs::{read_to_string, write}, - iter, path::{Component, Path, PathBuf}, }; @@ -185,8 +184,9 @@ pub(crate) fn link<P: AsRef<Path>, Q: AsRef<Path>>( "script.Parent".to_string() }; - let path = iter::once(Ok(beginning)) - .chain(path.components().map(|component| { + let mut components = path + .components() + .map(|component| { Ok(match component { Component::ParentDir => ".Parent".to_string(), Component::Normal(part) => format!( @@ -195,8 +195,11 @@ pub(crate) fn link<P: AsRef<Path>, Q: AsRef<Path>>( ), _ => unreachable!("invalid path component"), }) - })) - .collect::<Result<String, LinkingError>>()?; + }) + .collect::<Result<Vec<_>, LinkingError>>()?; + components.pop(); + + let path = beginning + &components.join("") + &format!("[{name:?}]"); debug!( "writing linking file for {} with import `{path}` to {}",