From 42dd40e5e0c0689027ea4d8f053bbcb0697fcf21 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 30 Jan 2026 23:27:31 +0800 Subject: fix get programfile for cosmocc --- core/src/xmake/engine.c | 8 +++++++- tests/modules/binutils/test.lua | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index 2e3ad61b7..eb07fe2b5 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -915,7 +915,13 @@ static tb_bool_t xm_engine_get_program_file(xm_engine_t *engine, tb_char_t **arg if (!ok && argv) { tb_char_t const *p = argv[0]; if (p && tb_file_info(p, tb_null)) { - tb_strlcpy(path, p, maxn); + if (tb_path_is_absolute(p)) { + tb_strlcpy(path, p, maxn); + } else { + if (!tb_path_absolute(p, path, maxn)) { + tb_strlcpy(path, p, maxn); + } + } ok = tb_true; } } diff --git a/tests/modules/binutils/test.lua b/tests/modules/binutils/test.lua index da8030558..b9c50b190 100644 --- a/tests/modules/binutils/test.lua +++ b/tests/modules/binutils/test.lua @@ -34,7 +34,7 @@ function test_format(t) elseif is_host("macosx", "iphoneos", "watchos", "appletvos") then expected = "macho" end - t:are_equal(binutils.format(path.absolute(programfile)), expected) + t:are_equal(binutils.format(programfile), expected) end local ar = path.join(tempdir, "a.a") -- cgit v1.3.1