Merge branch 'tmj-dev'

This commit is contained in:
milek7
2018-03-11 21:19:53 +01:00
15 changed files with 58 additions and 62 deletions

View File

@@ -321,3 +321,19 @@ last_modified( std::string const &Filename ) {
else
return 0;
}
// potentially erases file extension from provided file name. returns: true if extension was removed, false otherwise
bool
erase_extension( std::string &Filename ) {
auto const extensionpos { Filename.rfind( '.' ) };
if( extensionpos == std::string::npos ) { return false; }
if( extensionpos != Filename.rfind( ".." ) + 1 ) {
// we can get extension for .mat or, in legacy files, some image format. just trim it and set it to material file extension
Filename.erase( extensionpos );
return true;
}
return false;
}