From 70a8864e9f667a8d8bd6704c0926b3d57219fbc0 Mon Sep 17 00:00:00 2001 From: "A. R. Shajii" Date: Sun, 17 Oct 2021 16:26:26 -0400 Subject: [PATCH] Fallback to default plugin install path --- .github/actions/build-manylinux/entrypoint.sh | 2 +- .github/workflows/ci.yml | 2 +- codon/dsl/plugins.cpp | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/build-manylinux/entrypoint.sh b/.github/actions/build-manylinux/entrypoint.sh index 44cf02e5..e8495ae6 100755 --- a/.github/actions/build-manylinux/entrypoint.sh +++ b/.github/actions/build-manylinux/entrypoint.sh @@ -34,7 +34,7 @@ build/codon run test/core/exit.codon || if [[ $? -ne 42 ]]; then false; fi # package export CODON_BUILD_ARCHIVE=codon-$(uname -s | awk '{print tolower($0)}')-$(uname -m).tar.gz -mkdir -p codon-deploy/bin codon-deploy/lib/codon +mkdir -p codon-deploy/bin codon-deploy/lib/codon codon-deploy/plugins cp build/codon codon-deploy/bin/ cp build/libcodon*.so codon-deploy/lib/codon/ cp build/libomp.so codon-deploy/lib/codon/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 451a6bd6..4c22050b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,7 +184,7 @@ jobs: - name: Prepare Artifacts run: | - mkdir -p codon-deploy/bin codon-deploy/lib/codon + mkdir -p codon-deploy/bin codon-deploy/lib/codon codon-deploy/plugins cp build/codon codon-deploy/bin/ cp build/libcodon*.${LIBEXT} codon-deploy/lib/codon/ cp build/libomp.${LIBEXT} codon-deploy/lib/codon/ diff --git a/codon/dsl/plugins.cpp b/codon/dsl/plugins.cpp index 4c49c826..d1cc876a 100644 --- a/codon/dsl/plugins.cpp +++ b/codon/dsl/plugins.cpp @@ -1,5 +1,6 @@ #include "plugins.h" +#include #include #include "codon/parser/common.h" @@ -27,7 +28,14 @@ bool PluginManager::load(const std::string &path, std::string *errMsg) { const std::string libExt = "so"; #endif - fs::path tomlPath = fs::path(path) / "plugin.toml"; + const std::string config = "plugin.toml"; + fs::path tomlPath = fs::path(path) / config; + if (!fs::exists(tomlPath)) { + // try default install path + if (auto *homeDir = std::getenv("HOME")) + tomlPath = fs::path(homeDir) / ".codon/plugins" / path / config; + } + toml::parse_result tml; try { tml = toml::parse_file(tomlPath.string());