mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 08:54:34 +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;
|
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:
|
case BadVersionState::BadFile:
|
||||||
ImGui::OpenPopup( "Bad file" );
|
ImGui::OpenPopup( "Bad file" );
|
||||||
break;
|
break;
|
||||||
|
case BadVersionState::ReadError:
|
||||||
|
ImGui::OpenPopup( "File read error" );
|
||||||
|
break;
|
||||||
case BadVersionState::UnsupportedVersion:
|
case BadVersionState::UnsupportedVersion:
|
||||||
ImGui::OpenPopup( "Unsupported file version" );
|
ImGui::OpenPopup( "Unsupported file version" );
|
||||||
break;
|
break;
|
||||||
@ -43,6 +46,20 @@ void BadVersionImpl( BadVersionState& badVer )
|
|||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
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 ) )
|
if( ImGui::BeginPopupModal( "Unsupported file version", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||||
{
|
{
|
||||||
#ifdef TRACY_EXTENDED_FONT
|
#ifdef TRACY_EXTENDED_FONT
|
||||||
|
@ -12,6 +12,7 @@ struct BadVersionState
|
|||||||
{
|
{
|
||||||
Ok,
|
Ok,
|
||||||
BadFile,
|
BadFile,
|
||||||
|
ReadError,
|
||||||
UnsupportedVersion,
|
UnsupportedVersion,
|
||||||
LegacyVersion
|
LegacyVersion
|
||||||
};
|
};
|
||||||
|
@ -9768,6 +9768,10 @@ void View::DrawCompare()
|
|||||||
{
|
{
|
||||||
m_compare.badVer.state = BadVersionState::BadFile;
|
m_compare.badVer.state = BadVersionState::BadFile;
|
||||||
}
|
}
|
||||||
|
catch( const tracy::FileReadError& )
|
||||||
|
{
|
||||||
|
m_compare.badVer.state = BadVersionState::ReadError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tracy::BadVersion( m_compare.badVer );
|
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" );
|
fprintf( stderr, "The file you are trying to open is not a tracy dump.\n" );
|
||||||
exit( 1 );
|
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 )
|
catch( const tracy::LegacyVersion& e )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "The file you are trying to open is from a legacy version.\n" );
|
fprintf( stderr, "The file you are trying to open is from a legacy version.\n" );
|
||||||
|
Loading…
Reference in New Issue
Block a user