diff --git a/CHANGELOG.md b/CHANGELOG.md index 66e319f..1a2554e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixed +- Fix double path long prefix issues on Windows by @daimond113 + ## [0.6.0-rc.5] - 2025-02-10 ### Fixed - Correct script linker require paths on Windows by @daimond113 diff --git a/src/linking/mod.rs b/src/linking/mod.rs index 5e9f668..804715c 100644 --- a/src/linking/mod.rs +++ b/src/linking/mod.rs @@ -166,6 +166,8 @@ impl Project { package_types: &Arc, is_complete: bool, ) -> Result<(), errors::LinkingError> { + let package_dir_canonical = fs::canonicalize(self.package_dir()).await?; + let mut tasks = JoinSet::>::new(); let mut link_files = |base_folder: &Path, container_folder: &Path, @@ -224,8 +226,7 @@ impl Project { .scripts() .filter(|s| !s.is_empty() && node.node.direct.is_some() && is_root) { - let scripts_base = self - .package_dir() + let scripts_base = package_dir_canonical .join(SCRIPTS_LINK_FOLDER) .join(alias.as_str()); diff --git a/src/main.rs b/src/main.rs index ee233e3..9c2afe5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -135,23 +135,8 @@ impl<'a> MakeWriter<'a> for IndicatifWriter { } } -#[cfg(windows)] -fn long_path_prefix(path: PathBuf) -> PathBuf { - if path.starts_with(r"\\?\") { - path - } else { - let mut str = std::ffi::OsString::from(r"\\?\"); - str.push(path.into_os_string()); - str.into() - } -} - async fn run() -> anyhow::Result<()> { let cwd = std::env::current_dir().expect("failed to get current working directory"); - // pathdiff doesn't work properly when diffing paths with and without long path prefixes - // so, we'll try to use the long path prefix where ever possible - #[cfg(windows)] - let cwd = long_path_prefix(cwd); // Unix doesn't return the symlinked path, so we need to get it from the 0 argument #[cfg(unix)] let current_exe = PathBuf::from(std::env::args_os().next().expect("argument 0 not set"));