diff options
| author | ruki <[email protected]> | 2024-08-22 22:50:28 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2024-08-22 22:50:28 +0800 |
| commit | b657911e2b0c34674570368c73c5025eff9d7649 (patch) | |
| tree | 7755d6b1502f1e94fef917bf8871ea7fb2a5d73e /core/src | |
| parent | a903a1ab46c1326335d7674f1ec0f2a539f8c030 (diff) | |
support for windows
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/engine.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index 71a997881..8aa010914 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -654,7 +654,7 @@ static tb_bool_t xm_engine_save_arguments(xm_engine_t* engine, tb_int_t argc, tb return tb_true; } -static tb_size_t xm_engine_get_program_file(xm_engine_t* engine, tb_char_t* path, tb_size_t maxn) +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) { // check 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 } #endif + tb_char_t const* p = argv? argv[0] : tb_null; + if (p && tb_file_info(p, tb_null)) + { + tb_strlcpy(path, p, maxn); + ok = tb_true; + break; + } + } while (0); // 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 if (!xm_engine_get_project_directory(engine, path, sizeof(path))) return -1; // get the program file - if (!xm_engine_get_program_file(engine, path, sizeof(path))) return -1; + if (!xm_engine_get_program_file(engine, argv, path, sizeof(path))) return -1; // get the program directory if (!xm_engine_get_program_directory(engine, path, sizeof(path), path)) return -1; |
