Commit a4a9669 for stable-diffusion.cpp

commit a4a966990d3956d52719d9224b860efa394b72a6
Author: mikemikimike <13286568797@163.com>
Date:   Thu Oct 8 23:40:43 2026 +0800

    fix: avoid scanning cwd during server startup (#2086)

diff --git a/examples/server/main.cpp b/examples/server/main.cpp
index 42c84df..1768f0d 100644
--- a/examples/server/main.cpp
+++ b/examples/server/main.cpp
@@ -75,6 +75,8 @@ int main(int argc, const char** argv) {
     }
     SDSvrParams svr_params;
     SDContextParams ctx_params;
+    // Preserve the CLI default while disabling cwd scans for sd-server.
+    ctx_params.lora_model_dir.clear();
     SDGenerationParams default_gen_params;

     sd_set_log_callback(sd_log_cb, (void*)&svr_params);
diff --git a/examples/server/runtime.cpp b/examples/server/runtime.cpp
index 3a20931..1a71cf7 100644
--- a/examples/server/runtime.cpp
+++ b/examples/server/runtime.cpp
@@ -254,6 +254,12 @@ std::string SDSvrParams::to_string() const {
 void refresh_lora_cache(ServerRuntime& rt) {
     std::vector<LoraEntry> new_cache;

+    if (rt.ctx_params->lora_model_dir.empty()) {
+        std::lock_guard<std::mutex> lock(*rt.lora_mutex);
+        rt.lora_cache->clear();
+        return;
+    }
+
     fs::path lora_dir = rt.ctx_params->lora_model_dir;
     std::error_code ec;
     if (fs::exists(lora_dir, ec) && !ec && fs::is_directory(lora_dir, ec) && !ec) {