Commit 75f76f53 authored by jan.koester's avatar jan.koester
Browse files

test

parent 4f7babcf
Loading
Loading
Loading
Loading
+32 −2
Original line number Diff line number Diff line
@@ -195,8 +195,38 @@ static bool handleDeployFallback(libhttppp::HttpRequest &curreq, const int tid,
    args.debug = debug;
    args.maxthreads = 0;

    for (size_t i = 0; i < cfg.getplgdirs(); ++i) {
        std::filesystem::path dir(cfg.getplgdir(i));
    std::vector<std::filesystem::path> pluginDirs;
    auto addDir = [&](const std::filesystem::path &dir) {
        if (dir.empty())
            return;
        for (const auto &existing : pluginDirs) {
            if (existing == dir)
                return;
        }
        pluginDirs.push_back(dir);
    };

    for (size_t i = 0; i < cfg.getplgdirs(); ++i)
        addDir(std::filesystem::path(cfg.getplgdir(i)));

    if (blogi::Blogi::Cfg) {
        for (size_t i = 0; i < blogi::Blogi::Cfg->getplgdirs(); ++i)
            addDir(std::filesystem::path(blogi::Blogi::Cfg->getplgdir(i)));
    }

    const char *envDeployDir = std::getenv("BLOGI_DEPLOY_PLUGIN_DIR");
    if (envDeployDir && envDeployDir[0] != '\0')
        addDir(std::filesystem::path(envDeployDir));

#ifdef Windows
    addDir(std::filesystem::path("C:/Program Files/blogi/plugins"));
#else
    addDir(std::filesystem::path("/usr/local/lib/blogi/plugins"));
    addDir(std::filesystem::path("/usr/lib/blogi/plugins"));
    addDir(std::filesystem::path("/lib/blogi/plugins"));
#endif

    for (const auto &dir : pluginDirs) {
        if (!std::filesystem::exists(dir) || !std::filesystem::is_directory(dir))
            continue;