Skip to content

Commit

Permalink
canonicalize base incremental path on windows
Browse files Browse the repository at this point in the history
This sidesteps problems with long paths because the canonical path
includes the "magic long path prefix" on Windows.
  • Loading branch information
nikomatsakis committed Nov 17, 2016
1 parent 4e844ad commit ab79438
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/librustc_incremental/persist/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit ab79438

Please sign in to comment.