1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Change file selector to work with callbacks.

This commit is contained in:
Bartosz Taudul
2022-10-06 17:35:07 +02:00
parent a4e39f3d5f
commit ec0757c03a
6 changed files with 82 additions and 94 deletions
+3 -5
View File
@@ -575,12 +575,10 @@ static void DrawContents()
#ifndef TRACY_NO_FILESELECTOR
if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open saved trace" ) && !loadThread.joinable() )
{
auto fn = tracy::Fileselector::OpenFile( "tracy", "Tracy Profiler trace file" );
if( !fn.empty() )
{
tracy::Fileselector::OpenFile( "tracy", "Tracy Profiler trace file", []( const char* fn ) {
try
{
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn.c_str() ) );
auto f = std::shared_ptr<tracy::FileRead>( tracy::FileRead::Open( fn ) );
if( f )
{
loadThread = std::thread( [f] {
@@ -609,7 +607,7 @@ static void DrawContents()
{
badVer.state = tracy::BadVersionState::ReadError;
}
}
} );
}
if( badVer.state != tracy::BadVersionState::Ok )