MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / GetSavePath

Function GetSavePath

Source/FileDialogs.cpp:36–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36std::optional<fs::path> GetSavePath(const fs::path &initFName, const fs::path &initPath, const CStringW &FilterName, const CStringW &FilterExt) {
37 CStringW defaultExt = FilterExt;
38 int index = defaultExt.Find(L';');
39 if (index != -1)
40 defaultExt.Truncate(index);
41
42 CStringW filter = LoadDefaultFilter(FilterName, FilterExt);
43 CFileDialog FileDialog(FALSE, !defaultExt.IsEmpty() ? (LPCWSTR)defaultExt : nullptr, initFName.c_str(), OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, filter);
44 if (!initPath.empty())
45 FileDialog.m_pOFN->lpstrInitialDir = initPath.c_str();
46
47 if (FileDialog.DoModal() != IDOK)
48 return std::nullopt;
49
50 return (LPCWSTR)FileDialog.GetPathName();
51}
52
53std::optional<fs::path> GetSavePath(const fs::path &initFName, const fs::path &initPath, UINT nFilterID, const CStringW &FilterExt) {
54 return GetSavePath(initFName, initPath, CStringW(MAKEINTRESOURCEW(nFilterID)), FilterExt);

Callers 10

OnBnClickedBeginMethod · 0.85
OnSaveInstrumentMethod · 0.85
OnFileExportTextMethod · 0.85
OnFileExportRowsMethod · 0.85
OnFileExportJsonMethod · 0.85
WithFileMethod · 0.85
CreateBINMethod · 0.85
OnBnClickedSaveMethod · 0.85

Calls 4

LoadDefaultFilterFunction · 0.85
FindMethod · 0.80
IsEmptyMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected