mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Report if file selector can be displayed.
This commit is contained in:
parent
343e7b6866
commit
fbfd7e5186
@ -35,7 +35,7 @@ extern "C" int nativeOpenFile()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void OpenFile( const char* ext, const char* desc, std::function<void(const char*)> callback )
|
bool OpenFile( const char* ext, const char* desc, std::function<void(const char*)> callback )
|
||||||
{
|
{
|
||||||
#ifndef TRACY_NO_FILESELECTOR
|
#ifndef TRACY_NO_FILESELECTOR
|
||||||
# ifdef __EMSCRIPTEN__
|
# ifdef __EMSCRIPTEN__
|
||||||
@ -58,6 +58,7 @@ void OpenFile( const char* ext, const char* desc, std::function<void(const char*
|
|||||||
};
|
};
|
||||||
input.click();
|
input.click();
|
||||||
}, ext );
|
}, ext );
|
||||||
|
return true;
|
||||||
# else
|
# else
|
||||||
nfdu8filteritem_t filter = { desc, ext };
|
nfdu8filteritem_t filter = { desc, ext };
|
||||||
nfdu8char_t* fn;
|
nfdu8char_t* fn;
|
||||||
@ -65,12 +66,14 @@ void OpenFile( const char* ext, const char* desc, std::function<void(const char*
|
|||||||
{
|
{
|
||||||
callback( (const char*)fn );
|
callback( (const char*)fn );
|
||||||
NFD_FreePathU8( fn );
|
NFD_FreePathU8( fn );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveFile( const char* ext, const char* desc, std::function<void(const char*)> callback )
|
bool SaveFile( const char* ext, const char* desc, std::function<void(const char*)> callback )
|
||||||
{
|
{
|
||||||
#if !defined TRACY_NO_FILESELECTOR && !defined __EMSCRIPTEN__
|
#if !defined TRACY_NO_FILESELECTOR && !defined __EMSCRIPTEN__
|
||||||
nfdu8filteritem_t filter = { desc, ext };
|
nfdu8filteritem_t filter = { desc, ext };
|
||||||
@ -79,8 +82,10 @@ void SaveFile( const char* ext, const char* desc, std::function<void(const char*
|
|||||||
{
|
{
|
||||||
callback( (const char*)fn );
|
callback( (const char*)fn );
|
||||||
NFD_FreePathU8( fn );
|
NFD_FreePathU8( fn );
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,9 @@ namespace tracy::Fileselector
|
|||||||
void Init();
|
void Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
void OpenFile( const char* ext, const char* desc, std::function<void(const char*)> callback );
|
// Will return false if file selector cannot be presented to the user.
|
||||||
void SaveFile( const char* ext, const char* desc, std::function<void(const char*)> callback );
|
bool OpenFile( const char* ext, const char* desc, std::function<void(const char*)> callback );
|
||||||
|
bool SaveFile( const char* ext, const char* desc, std::function<void(const char*)> callback );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user