comparison OrthancServer/main.cpp @ 2295:5465cab476cf

Fix issue #45 (crash when providing a folder to "--config" command-line option)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 05 Jul 2017 12:26:31 +0200
parents ce5c13b95dac
children 03982a0db696
comparison
equal deleted inserted replaced
2294:e371519d4ac9 2295:5465cab476cf
1205 // Replace UNIX newlines with DOS newlines 1205 // Replace UNIX newlines with DOS newlines
1206 boost::replace_all(configurationSample, "\n", "\r\n"); 1206 boost::replace_all(configurationSample, "\n", "\r\n");
1207 #endif 1207 #endif
1208 1208
1209 std::string target = argument.substr(9); 1209 std::string target = argument.substr(9);
1210 SystemToolbox::WriteFile(configurationSample, target); 1210
1211 return 0; 1211 try
1212 {
1213 SystemToolbox::WriteFile(configurationSample, target);
1214 return 0;
1215 }
1216 catch (OrthancException&)
1217 {
1218 LOG(ERROR) << "Cannot write sample configuration as file \"" << target << "\"";
1219 return -1;
1220 }
1212 } 1221 }
1213 else 1222 else
1214 { 1223 {
1215 LOG(WARNING) << "Option unsupported by the core of Orthanc: " << argument; 1224 LOG(WARNING) << "Option unsupported by the core of Orthanc: " << argument;
1216 } 1225 }