diff options
| author | hardliner66 <hardliner66@gmail.com> | 2025-03-09 17:04:12 +0100 |
|---|---|---|
| committer | hardliner66 <hardliner66@gmail.com> | 2025-03-09 17:04:12 +0100 |
| commit | 10e365008c81bfe1ed2c16435b610636ddfef179 (patch) | |
| tree | b9d38d2c65d4fba2680242a41c0f806e7b12e002 /src/server/requests.odin | |
| parent | 45ed358bbee2febc0bbfcd6525cce26fb263bda7 (diff) | |
allow odin_command to be a relative path
Diffstat (limited to 'src/server/requests.odin')
| -rw-r--r-- | src/server/requests.odin | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/server/requests.odin b/src/server/requests.odin index f884b0d..780a91d 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -484,6 +484,15 @@ read_ols_initialize_options :: proc(config: ^common.Config, ols_config: OlsConfi odin_core_env: string odin_bin := "odin" if config.odin_command == "" else config.odin_command + // If we don't have an absolute path + if !filepath.is_abs(odin_bin) { + // Join with the project path + tmp_path := path.join(elems = {uri.path, odin_bin}) + if os.exists(tmp_path) { + odin_bin = tmp_path + } + } + root_buf: [1024]byte root_slice := root_buf[:] root_command := strings.concatenate({odin_bin, " root"}, context.temp_allocator) @@ -497,7 +506,7 @@ read_ols_initialize_options :: proc(config: ^common.Config, ols_config: OlsConfi odin_core_env = os.get_env("ODIN_ROOT", context.temp_allocator) if odin_core_env == "" { - if filepath.is_abs(odin_bin) { + if os.exists(odin_bin) { odin_core_env = filepath.dir(odin_bin, context.temp_allocator) } else if exe_path, ok := common.lookup_in_path(odin_bin); ok { odin_core_env = filepath.dir(exe_path, context.temp_allocator) |