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

Function GetLoadPath

Source/FileDialogs.cpp:57–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57std::optional<fs::path> GetLoadPath(const fs::path &initFName, const fs::path &initPath, const CStringW &FilterName, const CStringW &FilterExt) {
58 CStringW defaultExt = FilterExt;
59 int index = defaultExt.Find(L';');
60 if (index != -1)
61 defaultExt.Truncate(index);
62
63 CStringW filter = LoadDefaultFilter(FilterName, FilterExt);
64 CFileDialog FileDialog(TRUE, !defaultExt.IsEmpty() ? (LPCWSTR)defaultExt : nullptr, initFName.c_str(), OFN_HIDEREADONLY, filter);
65 if (!initPath.empty())
66 FileDialog.m_pOFN->lpstrInitialDir = initPath.c_str();
67
68 if (FileDialog.DoModal() != IDOK)
69 return std::nullopt;
70
71 return (LPCWSTR)FileDialog.GetPathName();
72}
73
74std::optional<fs::path> GetLoadPath(const fs::path &initFName, const fs::path &initPath, UINT nFilterID, const CStringW &FilterExt) {
75 return GetLoadPath(initFName, initPath, CStringW(MAKEINTRESOURCEW(nFilterID)), FilterExt);

Callers 4

OnBnClickedSongImportMethod · 0.85
OnFileImportTextMethod · 0.85

Calls 4

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

Tested by

no test coverage detected