We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c0f6987 commit d68a21fCopy full SHA for d68a21f
src/plugins/tbin/tidemapformat.cpp
@@ -558,13 +558,13 @@ QString TideMapFormat::shortName() const
558
559
bool TideMapFormat::supportsFile(const QString &fileName) const
560
{
561
- std::ifstream file(fileName.toStdString(), std::ios::in | std::ios::binary);
562
- if (!file)
+ QFile file( fileName );
+ if ( !file.exists() || !file.open( QFile::ReadOnly | QFile::Text ) )
563
return false;
564
565
// Not sure what a better way of doing this would be without pre-parsing the entire file...
566
- std::string magic(5, '\0');
567
- file.read(&magic[0], static_cast<std::streamsize>(magic.length()));
+ QTextStream text( &file );
+ QString magic = text.read( 5 );
568
569
return magic == "<?xml" || magic == "<Map ";
570
}
0 commit comments