Skip to content

Commit cfe8834

Browse files
Merge pull request #94 from GmodNET/HostfxrFullPath
Hostfxr full path
2 parents 7039c43 + 6d217a3 commit cfe8834

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ env:
99
jobs:
1010
linux-build:
1111

12-
runs-on: ubuntu-18.04
12+
runs-on: ubuntu-20.04
1313

1414
steps:
1515
- name: Checkout
@@ -51,7 +51,17 @@ jobs:
5151
- name: Run Garry's Mod
5252
run: ./srcds_run_x64 -game garrysmod -systemtest +sv_hibernate_think 1 || true
5353
working-directory: ./gmod/
54-
timeout-minutes: 5
54+
timeout-minutes: 1
55+
continue-on-error: true
56+
env:
57+
COREHOST_TRACE: 1
58+
COREHOST_TRACE_VERBOSITY: 4
59+
COREHOST_TRACEFILE: corehost_trace.txt
60+
61+
- name: Print Corehost trace
62+
working-directory: ./gmod/
63+
run: cat corehost_trace.txt
64+
continue-on-error: true
5565

5666
- name: Print test log
5767
run: cat gmod/tests-log.txt

gm_dotnet_native/dotnethelper-src/dotnethelper.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "LuaAPIExposure.h"
1010
#include <string>
1111
#include <fstream>
12+
#include <filesystem>
1213
#ifdef WIN32
1314
#include <Windows.h>
1415
#else
@@ -45,7 +46,7 @@ std::string hosfxr_path = "garrysmod/lua/bin/dotnet/host/fxr/" + std::string(NET
4546
#ifdef WIN32
4647
void* hostfxr_library_handle = LoadLibraryA((hosfxr_path + "/hostfxr.dll").c_str());
4748
#elif __APPLE__
48-
void* hostfxr_library_handle = dlopen((hosfxr_path + "/libhostfxr.dylib").c_str(), RTLD_LAZY);
49+
void* hostfxr_library_handle = dlopen((hosfxr_path + "/libhostfxr.dylib").c_str(), RTLD_LAZY | RTLD_LOCAL);
4950
#elif __gnu_linux__
5051
void* hostfxr_library_handle = dlopen((hosfxr_path + "/libhostfxr.so").c_str(), RTLD_LAZY);
5152
#endif
@@ -184,11 +185,10 @@ extern "C" DYNANAMIC_EXPORT cleanup_function_fn InitNetRuntime(GarrysMod::Lua::I
184185
game_exe_path[game_exe_path_len] = '\0';
185186
#endif
186187
dotnet_runtime_params.host_path = game_exe_path;
187-
#ifdef WIN32
188-
dotnet_runtime_params.dotnet_root = L"garrysmod/lua/bin/dotnet";
189-
#else
190-
dotnet_runtime_params.dotnet_root = "garrysmod/lua/bin/dotnet";
191-
#endif
188+
189+
std::filesystem::path dotnet_root_path = std::filesystem::current_path() / "garrysmod" / "lua" / "bin" / "dotnet";
190+
dotnet_runtime_params.dotnet_root = dotnet_root_path.native().c_str();
191+
192192
int init_success_code = hostfxr_initialize_for_dotnet_command_line(2, dotnet_args, &dotnet_runtime_params, &runtime_environment_handle);
193193
if(init_success_code != 0)
194194
{

0 commit comments

Comments
 (0)