mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Handle FileReadError.
This commit is contained in:
parent
eb79507501
commit
1492536bdb
@ -581,6 +581,10 @@ static void DrawContents()
|
||||
{
|
||||
badVer.state = tracy::BadVersionState::BadFile;
|
||||
}
|
||||
catch( const tracy::FileReadError& )
|
||||
{
|
||||
badVer.state = tracy::BadVersionState::ReadError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,9 @@ void BadVersionImpl( BadVersionState& badVer )
|
||||
case BadVersionState::BadFile:
|
||||
ImGui::OpenPopup( "Bad file" );
|
||||
break;
|
||||
case BadVersionState::ReadError:
|
||||
ImGui::OpenPopup( "File read error" );
|
||||
break;
|
||||
case BadVersionState::UnsupportedVersion:
|
||||
ImGui::OpenPopup( "Unsupported file version" );
|
||||
break;
|
||||
@ -43,6 +46,20 @@ void BadVersionImpl( BadVersionState& badVer )
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
if( ImGui::BeginPopupModal( "File read error", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||
{
|
||||
#ifdef TRACY_EXTENDED_FONT
|
||||
TextCentered( ICON_FA_EXCLAMATION_TRIANGLE );
|
||||
#endif
|
||||
ImGui::Text( "The file you are trying to open cannot be mapped to memory." );
|
||||
ImGui::Separator();
|
||||
if( ImGui::Button( "OK" ) )
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
badVer.state = BadVersionState::Ok;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||
{
|
||||
#ifdef TRACY_EXTENDED_FONT
|
||||
|
@ -12,6 +12,7 @@ struct BadVersionState
|
||||
{
|
||||
Ok,
|
||||
BadFile,
|
||||
ReadError,
|
||||
UnsupportedVersion,
|
||||
LegacyVersion
|
||||
};
|
||||
|
@ -9768,6 +9768,10 @@ void View::DrawCompare()
|
||||
{
|
||||
m_compare.badVer.state = BadVersionState::BadFile;
|
||||
}
|
||||
catch( const tracy::FileReadError& )
|
||||
{
|
||||
m_compare.badVer.state = BadVersionState::ReadError;
|
||||
}
|
||||
}
|
||||
}
|
||||
tracy::BadVersion( m_compare.badVer );
|
||||
|
@ -139,6 +139,11 @@ int main( int argc, char** argv )
|
||||
fprintf( stderr, "The file you are trying to open is not a tracy dump.\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
catch( const tracy::FileReadError& e )
|
||||
{
|
||||
fprintf( stderr, "The file you are trying to open cannot be mapped to memory.\n" );
|
||||
exit( 1 );
|
||||
}
|
||||
catch( const tracy::LegacyVersion& e )
|
||||
{
|
||||
fprintf( stderr, "The file you are trying to open is from a legacy version.\n" );
|
||||
|
Loading…
Reference in New Issue
Block a user