# HG changeset patch # User Alain Mazy # Date 1761053166 -7200 # Node ID f8110e8449b9c6a2ee8cf722ca1566dd7b5db6cc # Parent d4e2fed7bfff0e4e1a522fbedc092c2db84560ba fix wl diff -r d4e2fed7bfff -r f8110e8449b9 OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp --- a/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Tue Oct 21 12:42:36 2025 +0200 +++ b/OrthancServer/Plugins/Samples/ModalityWorklists/Plugin.cpp Tue Oct 21 15:26:06 2025 +0200 @@ -237,27 +237,34 @@ fs::path source = worklistDirectory_; fs::directory_iterator end; - for (fs::directory_iterator it(source); it != end; ++it) + try { - fs::file_type type(it->status().type()); - - if (type == fs::regular_file || - type == fs::reparse_file) // cf. BitBucket issue #11 + for (fs::directory_iterator it(source); it != end; ++it) { - std::string extension = it->path().extension().string(); - std::transform(extension.begin(), extension.end(), extension.begin(), tolower); // Convert to lowercase + fs::file_type type(it->status().type()); - if (extension == ".wl") + if (type == fs::regular_file || + type == fs::reparse_file) // cf. BitBucket issue #11 { - std::string worklistId = Orthanc::SystemToolbox::PathToUtf8(it->path().filename().replace_extension("")); - std::string dicomContent; - Orthanc::SystemToolbox::ReadFile(dicomContent, it->path()); + std::string extension = it->path().extension().string(); + std::transform(extension.begin(), extension.end(), extension.begin(), tolower); // Convert to lowercase - Worklist wl(worklistId, dicomContent); - target.push_back(wl); + if (extension == ".wl") + { + std::string worklistId = Orthanc::SystemToolbox::PathToUtf8(it->path().filename().replace_extension("")); + std::string dicomContent; + Orthanc::SystemToolbox::ReadFile(dicomContent, it->path()); + + Worklist wl(worklistId, dicomContent); + target.push_back(wl); + } } } } + catch (fs::filesystem_error&) + { + LOG(ERROR) << "Inexistent folder while scanning for worklists: " + source.string(); + } } @@ -381,7 +388,7 @@ LOG(INFO) << "Deleting worklist " << it->id_ << " " << deleteDelayInHours_ << " hours after its creation"; DeleteWorklist(it->id_); } - else + else if (deleteWorklistsOnStableStudy_) { std::string studyInstanceUid; std::string patientId; @@ -634,7 +641,7 @@ bool hasKeyValueStores = OrthancPlugins::RestApiGet(system, "/system", false) && system.isMember("Capabilities") && system["Capabilities"].isMember("HasKeyValueStores") && system["Capabilities"]["HasKeyValueStores"].asBool(); - if (!hasKeyValueStores) + if (worklistStorage_ == WorklistStorageType_OrthancDb && !hasKeyValueStores) { LOG(ERROR) << "The Orthanc DB plugin does not support Key Value Stores. It is therefore impossible to store the worklists in Orthanc Database"; return OrthancPluginErrorCode_IncompatibleConfigurations;