MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / openFileDialog

Method openFileDialog

Simulator/SimulatorBase.cpp:2795–2821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2793}
2794
2795std::string SimulatorBase::openFileDialog(const std::string &defaultPath, const std::string filterName, const std::string fileFilter)
2796{
2797 std::string fileName = "";
2798#ifdef USE_NFD_FILE_DIALOG
2799 NFD_Init();
2800
2801 nfdchar_t* outPath;
2802 nfdfilteritem_t filterItem[1] = { { filterName.c_str(), fileFilter.c_str() } };
2803 nfdresult_t result = NFD_OpenDialog(&outPath, filterItem, 1, defaultPath.c_str());
2804 if (result == NFD_OKAY)
2805 {
2806 fileName = outPath;
2807 NFD_FreePath(outPath);
2808 }
2809 else if (result == NFD_CANCEL)
2810 {
2811 }
2812 else
2813 {
2814 LOG_ERR << "Error: " << NFD_GetError();
2815 }
2816
2817 NFD_Quit();
2818#endif
2819
2820 return fileName;
2821}
2822
2823std::string SimulatorBase::saveFileDialog(const std::string& defaultPath, const std::string &defaultName, const std::string filterName, const std::string fileFilter)
2824{

Callers

nothing calls this directly

Calls 4

NFD_InitFunction · 0.50
NFD_GetErrorFunction · 0.50
NFD_QuitFunction · 0.50
c_strMethod · 0.45

Tested by

no test coverage detected