Skip to content

Commit

Permalink
fix windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Dec 20, 2024
1 parent 6f1016c commit a091686
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/rattler/src/install/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ pub fn copy_and_replace_cstring_placeholder(

fn symlink(source_path: &Path, destination_path: &Path) -> std::io::Result<()> {
#[cfg(windows)]
return fs::symlink_file(source_path, destination_path);
return fs_err::os::windows::fs::symlink_file(source_path, destination_path);
#[cfg(unix)]
return fs_err::os::unix::fs::symlink(source_path, destination_path);
}
Expand Down
14 changes: 4 additions & 10 deletions crates/rattler/src/install/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,13 +700,8 @@ pub fn link_package_sync(
// tracing::info!("directory already exists: {:?}", directory);
continue;
} else if allow_ref_links && cfg!(target_os = "macos") && !index_json.noarch.is_python() {
// currently this does not handle noarch packages
// tracing::info!(
// "reflinking directory from {:?} to {:?}",
// package_dir.join(&directory),
// target_dir.join(&directory)
// );
// reflink the whole directory if possible
// currently this does not handle noarch packages
match reflink_copy::reflink(package_dir.join(&directory), &full_path) {
Ok(_) => {
created_directories.insert(directory.clone());
Expand All @@ -725,7 +720,6 @@ pub fn link_package_sync(
Err(e) => return Err(InstallError::FailedToCreateDirectory(full_path, e)),
}
} else {
// tracing::info!("creating directory: {:?}", directory);
match fs::create_dir(&full_path) {
Ok(_) => (),
Err(e) if e.kind() == ErrorKind::AlreadyExists => (),
Expand All @@ -734,7 +728,7 @@ pub fn link_package_sync(
}
}

// TODO take care of all the reflinked files:
// Take care of all the reflinked files (macos only)
// - Add them to the paths.json
// - Fix any occurences of the prefix in the files
// - Rename files that need clobber-renames
Expand All @@ -752,12 +746,12 @@ pub fn link_package_sync(
} else {
reflinked_paths_entries.push(PathsEntry {
relative_path: file.0.relative_path,
original_path: None,
path_type: file.0.path_type.into(),
no_link: file.0.no_link,
sha256: file.0.sha256,
size_in_bytes: file.0.size_in_bytes,
// No placeholder, so both are none for sure
// No placeholder, no clobbering, so these are none for sure
original_path: None,
sha256_in_prefix: None,
file_mode: None,
prefix_placeholder: None,
Expand Down

0 comments on commit a091686

Please sign in to comment.