Commit 6554b4e9 authored by remi cresson's avatar remi cresson
Browse files

ENH: throw an exception if the dates file is not on the filesystem

parent b005bced
......@@ -95,10 +95,8 @@ typedef std::vector<SingleDate> DatesType;
DatesType GetDatesFromStringVector(std::vector<std::string> & list, bool check_order = true){
DatesType dates;
for (unsigned int i = 0 ; i < list.size() ; i++)
{
if (list[i].size() >= 8) // YYYYMMDD
{
int yyyy, mm, dd;
......@@ -145,6 +143,10 @@ DatesType GetDatesFromFile(std::string filename)
{
std::vector<std::string> list;
ifstream file(filename);
if (!file.is_open())
{
itkGenericExceptionMacro("Can not open file " << filename);
}
std::copy(std::istream_iterator<std::string>(file),
std::istream_iterator<std::string>(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment