@@ -266,6 +266,7 @@ void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) {
266266struct LoraEntry {
267267 std::string name;
268268 std::string path;
269+ std::string fullpath;
269270};
270271
271272int main (int argc, const char ** argv) {
@@ -321,7 +322,8 @@ int main(int argc, const char** argv) {
321322
322323 LoraEntry e;
323324 e.name = p.stem ().u8string ();
324- std::string rel = fs::relative (p, lora_dir).u8string ();
325+ e.fullpath = entry.path ();
326+ std::string rel = p.lexically_relative (lora_dir).u8string ();
325327 std::replace (rel.begin (), rel.end (), ' \\ ' , ' /' );
326328 e.path = rel;
327329
@@ -340,10 +342,11 @@ int main(int argc, const char** argv) {
340342 }
341343 };
342344
343- auto is_valid_lora_path = [&](const std::string& path) -> bool {
345+ auto get_lora_full_path = [&](const std::string& path) -> std::string {
344346 std::lock_guard<std::mutex> lock (lora_mutex);
345- return std::any_of (lora_cache.begin (), lora_cache.end (),
347+ auto it = std::find_if (lora_cache.begin (), lora_cache.end (),
346348 [&](const LoraEntry& e) { return e.path == path; });
349+ return (it != lora_cache.end ()) ? it->fullpath : " " ;
347350 };
348351
349352 httplib::Server svr;
@@ -862,11 +865,12 @@ int main(int argc, const char** argv) {
862865 return bad (" lora.path required" );
863866 }
864867
865- if (!is_valid_lora_path (path)) {
868+ std::string fullpath = get_lora_full_path (path);
869+ if (fullpath.empty ()) {
866870 return bad (" invalid lora path: " + path);
867871 }
868872
869- lora_path_storage.push_back (path );
873+ lora_path_storage.push_back (fullpath );
870874 sd_lora_t l;
871875 l.is_high_noise = is_high_noise;
872876 l.multiplier = multiplier;
0 commit comments