Skip to content

Commit

Permalink
Add FreeBSD-specific logic to pal::get_default_installation_dir_for_a…
Browse files Browse the repository at this point in the history
…rch (dotnet#100731)
  • Loading branch information
arrowd authored and michaelgsharp committed May 8, 2024
1 parent 9a7d947 commit 9397d86
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/native/corehost/hostmisc/pal.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,22 @@ bool pal::get_default_installation_dir_for_arch(pal::architecture arch, pal::str
append_path(recv, get_arch_name(arch));
}
#endif
#elif defined(TARGET_FREEBSD)
int mib[2];
char buf[PATH_MAX];
size_t len = PATH_MAX;

mib[0] = CTL_USER;
mib[1] = USER_LOCALBASE;
if (::sysctl(mib, 2, buf, &len, NULL, 0) == 0)
{
recv->assign(buf);
recv->append(_X("/share/dotnet"));
}
else
{
recv->assign(_X("/usr/local/share/dotnet"));
}
#else
recv->assign(_X("/usr/share/dotnet"));
#endif
Expand Down

0 comments on commit 9397d86

Please sign in to comment.