comparison Core/Toolbox.cpp @ 1589:334d3a92ed83

improvements to the ServeFolders plugin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Aug 2015 17:43:00 +0200
parents b5bc87a7212d
children 4e56b5a206b7
comparison
equal deleted inserted replaced
1588:b5bc87a7212d 1589:334d3a92ed83
206 206
207 207
208 void Toolbox::ReadFile(std::string& content, 208 void Toolbox::ReadFile(std::string& content,
209 const std::string& path) 209 const std::string& path)
210 { 210 {
211 if (!boost::filesystem::is_regular_file(path))
212 {
213 LOG(ERROR) << "The path does not point to a regular file: " << path;
214 throw OrthancException(ErrorCode_RegularFileExpected);
215 }
216
211 boost::filesystem::ifstream f; 217 boost::filesystem::ifstream f;
212 f.open(path, std::ifstream::in | std::ifstream::binary); 218 f.open(path, std::ifstream::in | std::ifstream::binary);
213 if (!f.good()) 219 if (!f.good())
214 { 220 {
215 throw OrthancException(ErrorCode_InexistentFile); 221 throw OrthancException(ErrorCode_InexistentFile);