From f9dda0ca3ad9b6f070671c9c7e230f00bd379a77 Mon Sep 17 00:00:00 2001 From: Bryan Date: Thu, 19 Nov 2015 18:03:35 -0800 Subject: [PATCH] Corehost changes for linux/mac default installations --- src/corehost/src/pal.unix.cpp | 26 ++++++++++---------------- src/corehost/src/pal.windows.cpp | 2 ++ src/corehost/src/utils.cpp | 1 - 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/corehost/src/pal.unix.cpp b/src/corehost/src/pal.unix.cpp index 170cf1758..d338d4bc0 100644 --- a/src/corehost/src/pal.unix.cpp +++ b/src/corehost/src/pal.unix.cpp @@ -19,29 +19,23 @@ #define symlinkEntrypointExecutable "/proc/curproc/exe" #endif -bool coreclr_exists_in_dir(const pal::string_t& candidate) -{ - pal::string_t test(candidate); - append_path(test, _X("runtime")); - append_path(test, LIBCORECLR_NAME); - return pal::file_exists(test); -} - bool pal::find_coreclr(pal::string_t& recv) { pal::string_t candidate; pal::string_t test; - // Try %LocalAppData%\dotnet - if (pal::getenv(_X("LocalAppData"), candidate)) { - append_path(candidate, _X("dotnet")); - if (coreclr_exists_in_dir(candidate)) { - recv.assign(candidate); - return true; - } + // Try /usr/share/dotnet and /usr/local/share/dotnet + candidate.assign("/usr/share/dotnet/runtime/coreclr"); + if (coreclr_exists_in_dir(candidate)) { + recv.assign(candidate); + return true; } - // TODO: Try somewhere in Program Files, see https://github.com/dotnet/cli/issues/249 + candidate.assign("/usr/local/share/dotnet/runtime/coreclr"); + if (coreclr_exists_in_dir(candidate)) { + recv.assign(candidate); + return true; + } return false; } diff --git a/src/corehost/src/pal.windows.cpp b/src/corehost/src/pal.windows.cpp index 6c05f2328..9059c940e 100644 --- a/src/corehost/src/pal.windows.cpp +++ b/src/corehost/src/pal.windows.cpp @@ -18,6 +18,8 @@ bool pal::find_coreclr(pal::string_t& recv) // Try %LocalAppData%\dotnet if (pal::getenv(_X("LocalAppData"), candidate)) { append_path(candidate, _X("dotnet")); + append_path(candidate, _X("runtime")); + append_path(candidate, _X("coreclr")); if (coreclr_exists_in_dir(candidate)) { recv.assign(candidate); return true; diff --git a/src/corehost/src/utils.cpp b/src/corehost/src/utils.cpp index 4bfb66a79..222bb269d 100644 --- a/src/corehost/src/utils.cpp +++ b/src/corehost/src/utils.cpp @@ -7,7 +7,6 @@ bool coreclr_exists_in_dir(const pal::string_t& candidate) { pal::string_t test(candidate); - append_path(test, _X("runtime")); append_path(test, LIBCORECLR_NAME); trace::verbose(_X("checking for CoreCLR in default location: %s"), test.c_str()); return pal::file_exists(test);