summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/xmake/engine.c8
-rw-r--r--tests/modules/binutils/test.lua2
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")