Try to capture cause of BTG load failures
This commit is contained in:
committed by
James Turner
parent
f3847bd10f
commit
2fb20f793b
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
#include <simgear/bucket/newbucket.hxx>
|
#include <simgear/bucket/newbucket.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
#include <simgear/misc/strutils.hxx>
|
||||||
#include <simgear/math/SGGeometry.hxx>
|
#include <simgear/math/SGGeometry.hxx>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
@@ -563,6 +564,12 @@ bool SGBinObject::read_bin( const SGPath& file ) {
|
|||||||
// read headers
|
// read headers
|
||||||
unsigned int header;
|
unsigned int header;
|
||||||
sgReadUInt( fp, &header );
|
sgReadUInt( fp, &header );
|
||||||
|
|
||||||
|
if (sgReadError()) {
|
||||||
|
gzclose(fp);
|
||||||
|
throw sg_io_exception("Unable to read BTG header: " + simgear::strutils::error_string(errno), sg_location(file));
|
||||||
|
}
|
||||||
|
|
||||||
if ( ((header & 0xFF000000) >> 24) == 'S' &&
|
if ( ((header & 0xFF000000) >> 24) == 'S' &&
|
||||||
((header & 0x00FF0000) >> 16) == 'G' ) {
|
((header & 0x00FF0000) >> 16) == 'G' ) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user