diff options
author | 2016-02-19 08:21:13 +0000 | |
---|---|---|
committer | 2016-02-19 09:08:31 +0000 | |
commit | 47afaabfe8d8d05df923bf43131cfbf9506b7983 (patch) | |
tree | 505fc27e8237396b4e6a686f24b2d7d3d4b43648 /src/main/cpp/blaze.cc | |
parent | 7fab0251671ecb391f913332eec9e1e3d48785f8 (diff) |
Windows: use junctions to link to installation directory.
Win32 have no good API for that (basically we need to resort to ioctl
call). Shelling out to mklink.
Needed for #276.
--
MOS_MIGRATED_REVID=115040968
Diffstat (limited to 'src/main/cpp/blaze.cc')
-rw-r--r-- | src/main/cpp/blaze.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc index 0c4fa76a79..336dbc2d8e 100644 --- a/src/main/cpp/blaze.cc +++ b/src/main/cpp/blaze.cc @@ -1009,6 +1009,8 @@ static void EnsureCorrectRunningVersion() { // installation is running. string installation_path = globals->options.output_base + "/install"; char prev_installation[PATH_MAX + 1] = ""; // NULs the whole array + // TODO(dslomov): On Windows, readlink always fails, + // so we do the linking every time. if (readlink(installation_path.c_str(), prev_installation, PATH_MAX) == -1 || prev_installation != globals->options.install_base) { @@ -1016,8 +1018,8 @@ static void EnsureCorrectRunningVersion() { globals->restart_reason = NEW_VERSION; } unlink(installation_path.c_str()); - if (symlink(globals->options.install_base.c_str(), - installation_path.c_str())) { + if (!SymlinkDirectories(globals->options.install_base.c_str(), + installation_path.c_str())) { pdie(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR, "failed to create installation symlink '%s'", installation_path.c_str()); |