convert path to lowercase when linking
This commit is contained in:
@@ -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())
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user