| 492 | } |
| 493 | |
| 494 | void openFileDialogAsync( std::function<void( const std::filesystem::path& )> callback, const FileParameters& params /*= {} */ ) |
| 495 | { |
| 496 | assert( callback ); |
| 497 | #ifndef __EMSCRIPTEN__ |
| 498 | callback( openFileDialog( params ) ); |
| 499 | #else |
| 500 | sDialogFilesCallback = [callback] ( const std::vector<std::filesystem::path>& paths ) |
| 501 | { |
| 502 | if ( !paths.empty() ) |
| 503 | { |
| 504 | if ( !paths[0].empty() ) |
| 505 | FileDialogSignals::instance().onOpenFile( paths[0] ); |
| 506 | callback( paths[0] ); |
| 507 | } |
| 508 | }; |
| 509 | std::string accumFilter = webAccumFilter( params.filters ); |
| 510 | #pragma clang diagnostic push |
| 511 | #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension" |
| 512 | EM_ASM( open_files_dialog_popup( UTF8ToString( $0 ), $1), accumFilter.c_str(), false); |
| 513 | #pragma clang diagnostic pop |
| 514 | #endif |
| 515 | } |
| 516 | |
| 517 | std::vector<std::filesystem::path> openFilesDialog( const FileParameters& params ) |
| 518 | { |
no test coverage detected