Skip to content

Commit 4585e00

Browse files
authored
Add FreeBSD-specific logic to pal::get_default_installation_dir_for_arch (#100731)
1 parent bbbb686 commit 4585e00

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/native/corehost/hostmisc/pal.unix.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,22 @@ bool pal::get_default_installation_dir_for_arch(pal::architecture arch, pal::str
591591
append_path(recv, get_arch_name(arch));
592592
}
593593
#endif
594+
#elif defined(TARGET_FREEBSD)
595+
int mib[2];
596+
char buf[PATH_MAX];
597+
size_t len = PATH_MAX;
598+
599+
mib[0] = CTL_USER;
600+
mib[1] = USER_LOCALBASE;
601+
if (::sysctl(mib, 2, buf, &len, NULL, 0) == 0)
602+
{
603+
recv->assign(buf);
604+
recv->append(_X("/share/dotnet"));
605+
}
606+
else
607+
{
608+
recv->assign(_X("/usr/local/share/dotnet"));
609+
}
594610
#else
595611
recv->assign(_X("/usr/share/dotnet"));
596612
#endif

0 commit comments

Comments
 (0)