Look in multiple paths when searching for resource files of samples

When using an out of source build, the files are not in the default wxWidgets directories.
Also search in the current directory, parent directory and sample sub-directories.

Closes https://trac.wxwidgets.org/ticket/18118
This commit is contained in:
Maarten Bent
2018-05-17 19:42:43 +02:00
parent de4e20ee93
commit e581b72955
5 changed files with 27 additions and 7 deletions

View File

@@ -163,10 +163,16 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
help.UseConfig(wxConfig::Get());
bool ret;
help.SetTempDir(wxT("."));
ret = help.AddBook(wxFileName(wxT("helpfiles/testing.hhp"), wxPATH_UNIX));
wxPathList pathlist;
pathlist.Add(wxT("./helpfiles"));
pathlist.Add(wxT("../helpfiles"));
pathlist.Add(wxT("../../html/help/helpfiles"));
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("testing.hhp")), wxPATH_UNIX));
if (! ret)
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
ret = help.AddBook(wxFileName(wxT("helpfiles/another.hhp"), wxPATH_UNIX));
ret = help.AddBook(wxFileName(pathlist.FindValidPath(wxT("another.hhp")), wxPATH_UNIX));
if (! ret)
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
}