diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-11-17 12:44:46 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2016-11-17 13:44:22 -0500 |
| commit | ab79438d68dbc79da41fd97b2ffc3238d039b02d (patch) | |
| tree | 65d8a5ff41ef0eb1b39571752315ef2fa2d74259 | |
| parent | 4e844ad1e5d0f62cfac00ad0c0f50474d99331f7 (diff) | |
| download | rust-ab79438d68dbc79da41fd97b2ffc3238d039b02d.tar.gz rust-ab79438d68dbc79da41fd97b2ffc3238d039b02d.zip | |
canonicalize base incremental path on windows
This sidesteps problems with long paths because the canonical path includes the "magic long path prefix" on Windows.
| -rw-r--r-- | src/librustc_incremental/persist/fs.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs index 223200957cb..2572a9c1d78 100644 --- a/src/librustc_incremental/persist/fs.rs +++ b/src/librustc_incremental/persist/fs.rs @@ -201,6 +201,19 @@ pub fn prepare_session_directory(tcx: TyCtxt) -> Result<bool, ()> { debug!("crate-dir: {}", crate_dir.display()); try!(create_dir(tcx.sess, &crate_dir, "crate")); + // Hack: canonicalize the path *after creating the directory* + // because, on windows, long paths can cause problems; + // canonicalization inserts this weird prefix that makes windows + // tolerate long paths. + let crate_dir = match crate_dir.canonicalize() { + Ok(v) => v, + Err(err) => { + tcx.sess.err(&format!("incremental compilation: error canonicalizing path `{}`: {}", + crate_dir.display(), err)); + return Err(()); + } + }; + let mut source_directories_already_tried = FxHashSet(); loop { |
