save check of file ending

This commit is contained in:
Christoph Wintersteiger 2017-10-30 13:43:01 +01:00
parent 20d6a12192
commit ccc092d2c5

View File

@ -410,9 +410,9 @@ namespace netgen
void Mesh :: Save (const string & filename) const void Mesh :: Save (const string & filename) const
{ {
ostream * outfile; ostream * outfile;
if (filename.substr(filename.length()-7,7) == ".vol.gz") if (filename.find(".vol.gz")!=string::npos)
outfile = new ogzstream(filename.c_str()); outfile = new ogzstream(filename.c_str());
else if (filename.substr(filename.length()-4,4) == ".vol") else if (filename.find(".vol")!=string::npos)
outfile = new ofstream(filename.c_str()); outfile = new ofstream(filename.c_str());
else else
outfile = new ogzstream((filename+".vol.gz").c_str()); outfile = new ogzstream((filename+".vol.gz").c_str());