]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/lib.rs
port over symlink_file function from Build to Config and create symlink for legacy...
[rust.git] / src / bootstrap / lib.rs
index f4abdf1cc57589e51c8c8aec36e07e48dfdecac9..f753720b353066bcb05a8e9889a0d97497e70587 100644 (file)
@@ -20,7 +20,6 @@
 use std::collections::{HashMap, HashSet};
 use std::env;
 use std::fs::{self, File};
-use std::io;
 use std::io::ErrorKind;
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
@@ -1407,7 +1406,7 @@ fn copy_internal(&self, src: &Path, dst: &Path, dereference_symlinks: bool) {
                 src = t!(fs::canonicalize(src));
             } else {
                 let link = t!(fs::read_link(src));
-                t!(self.symlink_file(link, dst));
+                t!(self.config.symlink_file(link, dst));
                 return;
             }
         }
@@ -1525,14 +1524,6 @@ fn read_dir(&self, dir: &Path) -> impl Iterator<Item = fs::DirEntry> {
         iter.map(|e| t!(e)).collect::<Vec<_>>().into_iter()
     }
 
-    fn symlink_file<P: AsRef<Path>, Q: AsRef<Path>>(&self, src: P, link: Q) -> io::Result<()> {
-        #[cfg(unix)]
-        use std::os::unix::fs::symlink as symlink_file;
-        #[cfg(windows)]
-        use std::os::windows::fs::symlink_file;
-        if !self.config.dry_run() { symlink_file(src.as_ref(), link.as_ref()) } else { Ok(()) }
-    }
-
     /// Returns if config.ninja is enabled, and checks for ninja existence,
     /// exiting with a nicer error message if not.
     fn ninja(&self) -> bool {