diff options
| author | ruki <[email protected]> | 2026-01-30 23:27:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-01-30 23:27:31 +0800 |
| commit | 42dd40e5e0c0689027ea4d8f053bbcb0697fcf21 (patch) | |
| tree | 2684adce81da8ef6d3582404cd3bbff9ef31451e | |
| parent | 7fee203a6cabfdc83ee9304ee2b92d8b0202a6c5 (diff) | |
fix get programfile for cosmocc
| -rw-r--r-- | core/src/xmake/engine.c | 8 | ||||
| -rw-r--r-- | 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") |
