MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / saveFileDialogAsync

Function saveFileDialogAsync

source/MRViewer/MRFileDialog.cpp:648–677  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646}
647
648void saveFileDialogAsync( std::function<void( const std::filesystem::path& )> callback, const FileParameters& params /*= {} */ )
649{
650 assert( callback );
651#ifndef __EMSCRIPTEN__
652 callback( saveFileDialog( params ) );
653#else
654 sDialogFilesCallback = [callback] ( const std::vector<std::filesystem::path>& paths )
655 {
656 if ( !paths.empty() )
657 {
658 if ( !paths[0].empty() )
659 {
660 FileDialog::setLastUsedDir( paths[0].parent_path() );
661 FileDialogSignals::instance().onSaveFile( paths[0] );
662 }
663 callback( paths[0] );
664 }
665 };
666 auto filters = params.filters;
667 filters.erase( std::remove_if( filters.begin(), filters.end(), [] ( const auto& filter )
668 {
669 return filter.extensions == "*.*";
670 } ), filters.end() );
671 std::string accumFilter = webAccumFilter( params.filters );
672#pragma clang diagnostic push
673#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
674 EM_ASM( download_file_dialog_popup( UTF8ToString( $0 ), UTF8ToString( $1 ) ), params.fileName.c_str(), accumFilter.c_str() );
675#pragma clang diagnostic pop
676#endif
677}
678
679FileDialogSignals& FileDialogSignals::instance()
680{

Callers 2

actionMethod · 0.85
saveSceneAs_Method · 0.85

Calls 9

saveFileDialogFunction · 0.85
setLastUsedDirFunction · 0.85
instanceFunction · 0.85
webAccumFilterFunction · 0.85
eraseMethod · 0.80
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected