convert path to lowercase when linking

This commit is contained in:
2026-02-26 18:12:48 +01:00
parent 58505aeebc
commit 1f40e59519

View File

@@ -23,7 +23,7 @@ impl Linker {
} }
fn link_file(&self, from: &Path, to: &Path) -> Result<(), LinkerError> { fn link_file(&self, from: &Path, to: &Path) -> Result<(), LinkerError> {
let target = self.install_path().join(to); let target = self.install_path().join(path_to_lowercase(to));
if let Some(parent) = target.parent() { if let Some(parent) = target.parent() {
fs::create_dir_all(parent)?; fs::create_dir_all(parent)?;
@@ -34,7 +34,7 @@ impl Linker {
} }
fn remove_link(&self, to: &Path) -> Result<(), LinkerError> { fn remove_link(&self, to: &Path) -> Result<(), LinkerError> {
let file = self.install_path().join(to); let file = self.install_path().join(path_to_lowercase(to));
let metadata = fs::symlink_metadata(&file)?; let metadata = fs::symlink_metadata(&file)?;
if !metadata.file_type().is_symlink() { if !metadata.file_type().is_symlink() {
@@ -140,3 +140,7 @@ impl From<io::Error> for LinkerError {
Self::Io(e) Self::Io(e)
} }
} }
fn path_to_lowercase(path: &Path) -> PathBuf {
PathBuf::from(path.to_string_lossy().to_lowercase())
}