From a9d008f942efa2a471e48becb60936b34411db22 Mon Sep 17 00:00:00 2001 From: Marcin Kolny Date: Sat, 22 Jul 2023 01:46:10 +0100 Subject: [PATCH] Use `_fullpath` function on windows to get absolute path of a directory (#2377) There is no standard `realpath` function in the C/C++ standard libraries for Windows, use `_fullpath` function instead to get absolute path of a directory. --- core/iwasm/common/wasm_runtime_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index 5467065f6..9269cae34 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -2895,7 +2895,11 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst, wasm_fd = 3; for (i = 0; i < dir_count; i++, wasm_fd++) { +#ifdef BH_PLATFORM_WINDOWS + path = _fullpath(resolved_path, dir_list[i], PATH_MAX); +#else path = realpath(dir_list[i], resolved_path); +#endif if (!path) { if (error_buf) snprintf(error_buf, error_buf_size,