Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion code/loader/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
if not os.isfile(get_config("game")) then
print("Please set the path to Cyberpunk2077.exe using the xmake f --game=<path> command")
else
local function is_game_running(os)
if not is_plat("windows") then
return false
end
local stdout, stderr = os.iorunv("tasklist", {"/FI", "IMAGENAME eq Cyberpunk2077.exe"})
return #stdout >= 3
end

target("Cyberpunk2077")
set_kind("binary")
set_basename("Cyberpunk2077")
Expand All @@ -21,6 +29,10 @@ else

local modPath = path.join(red4extPlugins, "zzzCyberpunkMP")

if is_game_running(os) then
print("CyberpunkMP.dll not installed: game is running.")
return
end
if os.exists(modPath) then
if os.isdir(modPath) then
os.rmdir(modPath)
Expand All @@ -30,7 +42,7 @@ else
end

os.mkdir(modPath)

local client_dll_path = path.join(clientdir, "CyberpunkMP.dll")
local symlink_path = path.join(modPath, "CyberpunkMP.dll")

Expand Down Expand Up @@ -59,6 +71,10 @@ else

local modPath = path.join(red4extPlugins, "zzzCyberpunkMP")

if is_game_running(os) then
print("CyberpunkMP.dll not installed: game is running.")
return
end
if os.exists(modPath) then
if os.isdir(modPath) then
os.rmdir(modPath)
Expand Down
Loading