Skip to content

Commit

Permalink
Add FreeBSD-specific logic to pal::get_default_installation_dir_for_arch
Browse files Browse the repository at this point in the history
  • Loading branch information
arrowd committed Apr 6, 2024
1 parent 9b57a26 commit 6301bed
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 6301bed

Please sign in to comment.