Skip to content

Commit b657911

Browse files
committed
support for windows
1 parent a903a1a commit b657911

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/cosmocc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
4444
- name: Tests
4545
run: |
46+
ls -l core/build/
4647
core/build/xmake --version
4748
core/build/xmake lua -v -D tests/run.lua
4849

core/src/xmake/engine.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ static tb_bool_t xm_engine_save_arguments(xm_engine_t* engine, tb_int_t argc, tb
654654
return tb_true;
655655
}
656656

657-
static tb_size_t xm_engine_get_program_file(xm_engine_t* engine, tb_char_t* path, tb_size_t maxn)
657+
static tb_size_t xm_engine_get_program_file(xm_engine_t* engine, tb_char_t** argv, tb_char_t* path, tb_size_t maxn)
658658
{
659659
// check
660660
tb_assert_and_check_return_val(engine && path && maxn, tb_false);
@@ -745,6 +745,14 @@ static tb_size_t xm_engine_get_program_file(xm_engine_t* engine, tb_char_t* path
745745
}
746746
#endif
747747

748+
tb_char_t const* p = argv? argv[0] : tb_null;
749+
if (p && tb_file_info(p, tb_null))
750+
{
751+
tb_strlcpy(path, p, maxn);
752+
ok = tb_true;
753+
break;
754+
}
755+
748756
} while (0);
749757

750758
// ok?
@@ -1452,7 +1460,7 @@ tb_int_t xm_engine_main(xm_engine_ref_t self, tb_int_t argc, tb_char_t** argv, t
14521460
if (!xm_engine_get_project_directory(engine, path, sizeof(path))) return -1;
14531461

14541462
// get the program file
1455-
if (!xm_engine_get_program_file(engine, path, sizeof(path))) return -1;
1463+
if (!xm_engine_get_program_file(engine, argv, path, sizeof(path))) return -1;
14561464

14571465
// get the program directory
14581466
if (!xm_engine_get_program_directory(engine, path, sizeof(path), path)) return -1;

0 commit comments

Comments
 (0)