forked from mia/Aegisub
Fix error when the style catalog directory doesn't exist or is empty
Use wxDir::GetFirst/GetNext rather than wxFileFirstFile since the latter doesn't have any way to signal that there aren't actually any files to be found. Closes #1486. Originally committed to SVN as r6764.
This commit is contained in:
parent
2addf40b31
commit
3388281fb7
|
@ -336,9 +336,14 @@ void DialogStyleManager::LoadCatalog() {
|
||||||
CatalogList->Clear();
|
CatalogList->Clear();
|
||||||
|
|
||||||
// Get saved style catalogs
|
// Get saved style catalogs
|
||||||
wxString dirname = StandardPaths::DecodePath("?user/catalog/*.sty");
|
wxDir dir(StandardPaths::DecodePath("?user/catalog/"));
|
||||||
for (wxString curfile = wxFindFirstFile(dirname, wxFILE); !curfile.empty(); curfile = wxFindNextFile())
|
if (dir.IsOpened()) {
|
||||||
|
wxString curfile;
|
||||||
|
if (dir.GetFirst(&curfile, "*.sty", wxDIR_FILES))
|
||||||
CatalogList->Append(wxFileName(curfile).GetName());
|
CatalogList->Append(wxFileName(curfile).GetName());
|
||||||
|
while (dir.GetNext(&curfile))
|
||||||
|
CatalogList->Append(wxFileName(curfile).GetName());
|
||||||
|
}
|
||||||
|
|
||||||
// Create a default storage if there are none
|
// Create a default storage if there are none
|
||||||
if (CatalogList->IsListEmpty())
|
if (CatalogList->IsListEmpty())
|
||||||
|
|
Loading…
Reference in a new issue