comparison Plugins/Samples/ModalityWorklists/Plugin.cpp @ 1911:7a05144cb919

author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 28 Jan 2016 17:07:22 +0100
parents b1291df2f780
children 395522e46b2b
comparison
equal deleted inserted replaced
1910:c32a8fab4fc4 1911:7a05144cb919
122 OrthancPluginErrorCode Callback(OrthancPluginWorklistAnswers* answers, 122 OrthancPluginErrorCode Callback(OrthancPluginWorklistAnswers* answers,
123 const OrthancPluginWorklistQuery* query, 123 const OrthancPluginWorklistQuery* query,
124 const char* remoteAet, 124 const char* remoteAet,
125 const char* calledAet) 125 const char* calledAet)
126 { 126 {
127 namespace fs = boost::filesystem;
128
127 Json::Value json; 129 Json::Value json;
128 130
129 if (!GetQueryDicom(json, query)) 131 if (!GetQueryDicom(json, query))
130 { 132 {
131 return OrthancPluginErrorCode_InternalError; 133 return OrthancPluginErrorCode_InternalError;
135 std::string msg = ("Received worklist query from remote modality " + 137 std::string msg = ("Received worklist query from remote modality " +
136 std::string(remoteAet) + ":\n" + json.toStyledString()); 138 std::string(remoteAet) + ":\n" + json.toStyledString());
137 OrthancPluginLogInfo(context_, msg.c_str()); 139 OrthancPluginLogInfo(context_, msg.c_str());
138 } 140 }
139 141
140 boost::filesystem::path source(folder_); 142 fs::path source(folder_);
141 boost::filesystem::directory_iterator end; 143 fs::directory_iterator end;
142 144
143 try 145 try
144 { 146 {
145 for (boost::filesystem::directory_iterator it(source); it != end; ++it) 147 for (fs::directory_iterator it(source); it != end; ++it)
146 { 148 {
147 if (is_regular_file(it->status())) 149 fs::file_type type(it->status().type());
150
151 if (type == fs::regular_file ||
152 type == fs::reparse_file) // cf. BitBucket issue #11
148 { 153 {
149 std::string extension = boost::filesystem::extension(it->path()); 154 std::string extension = fs::extension(it->path());
150 ToLowerCase(extension); 155 ToLowerCase(extension);
151 156
152 if (extension == ".wl") 157 if (extension == ".wl")
153 { 158 {
154 OrthancPluginErrorCode error = MatchWorklist(answers, query, it->path().string()); 159 OrthancPluginErrorCode error = MatchWorklist(answers, query, it->path().string());
159 } 164 }
160 } 165 }
161 } 166 }
162 } 167 }
163 } 168 }
164 catch (boost::filesystem::filesystem_error&) 169 catch (fs::filesystem_error&)
165 { 170 {
166 std::string description = std::string("Inexistent folder while scanning for worklists: ") + source.string(); 171 std::string description = std::string("Inexistent folder while scanning for worklists: ") + source.string();
167 OrthancPluginLogError(context_, description.c_str()); 172 OrthancPluginLogError(context_, description.c_str());
168 return OrthancPluginErrorCode_DirectoryExpected; 173 return OrthancPluginErrorCode_DirectoryExpected;
169 } 174 }