Przeglądaj źródła

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.
Marcin Kolny 2 lat temu
rodzic
commit
a9d008f942
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      core/iwasm/common/wasm_runtime_common.c

+ 4 - 0
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,