Use correct check to do a tokensearch.
parent
483541ee25
commit
5319974fe1
|
@ -119,14 +119,18 @@ DXFImporter::~DXFImporter()
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the class can handle the format of the given file.
|
// Returns whether the class can handle the format of the given file.
|
||||||
bool DXFImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const
|
bool DXFImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig ) const {
|
||||||
{
|
const std::string& extension = GetExtension( pFile );
|
||||||
if ( checkSig ) {
|
if ( extension == "dxf" ) {
|
||||||
return SimpleExtensionCheck(pFile,"dxf");
|
return true;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if ( extension.empty() || checkSig ) {
|
||||||
static const char *pTokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" };
|
static const char *pTokens[] = { "SECTION", "HEADER", "ENDSEC", "BLOCKS" };
|
||||||
return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 4 );
|
return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -62,3 +62,10 @@ public:
|
||||||
TEST_F( utDXFImporterExporter, importDXFFromFileTest ) {
|
TEST_F( utDXFImporterExporter, importDXFFromFileTest ) {
|
||||||
EXPECT_TRUE( importerTest() );
|
EXPECT_TRUE( importerTest() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F( utDXFImporterExporter, importerWithoutExtensionTest ) {
|
||||||
|
Assimp::Importer importer;
|
||||||
|
const aiScene *scene = importer.ReadFile( ASSIMP_TEST_MODELS_DIR "/DXF/lineTest", aiProcess_ValidateDataStructure );
|
||||||
|
EXPECT_NE( nullptr, scene );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue