From 7eaccdb0d0e5c0bcb4874e57b35b03b29e74c103 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Thu, 4 Jan 2024 10:13:44 -0600 Subject: [PATCH] changed: linux actions to be `ubuntu-20.04`and fixed windows linking bug --- .github/workflows/onyx-build.yml | 8 ++++---- runtime/src/ort_directories.h | 26 +++++++++----------------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/onyx-build.yml b/.github/workflows/onyx-build.yml index 91d8e0a4..3c7caf05 100644 --- a/.github/workflows/onyx-build.yml +++ b/.github/workflows/onyx-build.yml @@ -16,7 +16,7 @@ on: jobs: setup: name: Set up - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 outputs: VERSION: ${{ steps.setup.outputs.VERSION }} DOING_RELEASE: ${{ steps.setup.outputs.DOING_RELEASE }} @@ -41,15 +41,15 @@ jobs: matrix: include: - build: linux-amd64 - os: ubuntu-latest + os: ubuntu-20.04 runtime_library: ovmwasm artifact_name: 'onyx-linux-ovm-amd64' - build: linux-amd64 - os: ubuntu-latest + os: ubuntu-20.04 runtime_library: wasmer artifact_name: 'onyx-linux-wasmer-amd64' - build: linux-amd64 - os: ubuntu-latest + os: ubuntu-20.04 runtime_library: none artifact_name: 'onyx-linux-none-amd64' - build: darwin-arm64 diff --git a/runtime/src/ort_directories.h b/runtime/src/ort_directories.h index 80c0f261..7974715b 100644 --- a/runtime/src/ort_directories.h +++ b/runtime/src/ort_directories.h @@ -181,17 +181,13 @@ ONYX_DEF(__dir_cwd, (WASM_I32, WASM_I32), (WASM_I32)) { #endif #if defined(_BH_WINDOWS) - // The GetCurrentDirectory symbol is causing a linker error. - // For a hotfix, I am leaving these unimplemented for now, - // but they should be fixed asap. - // - // int length = GetCurrentDirectory(params->data[1].of.i32, ONYX_PTR(params->data[0].of.i32)); - // if (length == 0 || length > params->data[1].of.i32) { - // results->data[0] = WASM_I32_VAL(-1); - // return NULL; - // } - - results->data[0] = WASM_I32_VAL(-1); + int length = GetCurrentDirectory(params->data[1].of.i32, ONYX_PTR(params->data[0].of.i32)); + if (length == 0 || length > params->data[1].of.i32) { + results->data[0] = WASM_I32_VAL(-1); + return NULL; + } + + results->data[0] = WASM_I32_VAL(length); return NULL; #endif } @@ -204,12 +200,8 @@ ONYX_DEF(__dir_chdir, (WASM_I32), (WASM_I32)) { #endif #if defined(_BH_WINDOWS) - // The SetCurrentDirectory symbol is causing a linker error. - // For a hotfix, I am leaving these unimplemented for now, - // but they should be fixed asap. - // - // int result = SetCurrentDirectory(ONYX_PTR(params->data[0].of.i32)); - results->data[0] = WASM_I32_VAL(0); + int result = SetCurrentDirectory(ONYX_PTR(params->data[0].of.i32)); + results->data[0] = WASM_I32_VAL(result ? 1 : 0); return NULL; #endif } -- 2.25.1