Skip to content

Commit

Permalink
Fixed failing test. Refs #7866.
Browse files Browse the repository at this point in the history
- If filename is invalid or does not exist then we want to return false.
  • Loading branch information
jawrainey committed Oct 16, 2013
1 parent 72f9466 commit de367a5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions Code/Mantid/Framework/ICat/src/CatalogDownloadDataFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,19 @@ namespace Mantid
/**
* Checks to see if the file to be downloaded is a datafile.
* @param fileName :: file name
* @returns true if the file is a data file
* @returns true if the file is a data file, otherwise false.
*/
bool CatalogDownloadDataFiles::isBinary(const std::string & fileName)
{
std::basic_string <char>::size_type dotIndex;
dotIndex = fileName.find_last_of (".");
std::string fextn=fileName.substr(dotIndex+1,fileName.size()-dotIndex);
std::transform(fextn.begin(),fextn.end(),fextn.begin(),tolower);

return !FileDescriptor::isAscii(fextn);
// If an invalid argument is passed (which is a test), then return false.
try
{
return !FileDescriptor::isAscii(fileName);
}
catch(std::invalid_argument&)
{
return false;
}
}

/**
Expand Down

0 comments on commit de367a5

Please sign in to comment.