feat(switch): 添加运行目标时自动执行nxlink的功能

添加on_run回调函数,在目标运行时会自动通过nxlink.exe启动生成的NRO文件
This commit is contained in:
2026-03-18 12:51:08 +08:00
parent 7fc056496b
commit fc81c2634c

View File

@@ -47,7 +47,6 @@ target("Frostbite2D")
-- 构建后生成 NRO 文件
-- 复制着色器文件到输出目录
after_build(function (target)
local elf_file = target:targetfile()
local output_dir = path.directory(elf_file)
@@ -80,4 +79,17 @@ target("Frostbite2D")
print("Copy assets directory: " .. assets_dir .. " -> " .. target_assets_dir)
end
end)
target_end()
on_run(function (target)
local output_dir = path.directory(target:targetfile())
local nro_file = path.join(output_dir, "hello_world.nro")
os.execv("cmd.exe", {
"/c",
"chcp 65001 >nul & nxlink.exe",
"-s",
"-a", "192.168.200.50",
nro_file
})
end)