diff --git a/platform/switch.lua b/platform/switch.lua index 6e933cb..50eeba6 100644 --- a/platform/switch.lua +++ b/platform/switch.lua @@ -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) \ No newline at end of file