+ wxString p(wxPathOnly(m_dirName));
+#if (defined(__UNIX__) || defined(__WXWINCE__)) && !defined(__OS2__)
+ if (p.empty()) p = wxT("/");
+#endif // __UNIX__
+ wxFileData *fd = new wxFileData(p, wxT(".."), wxFileData::is_dir, wxFileIconsTable::folder);
+ if (Add(fd, item) != -1)
+ item.m_itemId++;
+ else
+ delete fd;
+ }
+
+ wxString dirname(m_dirName);
+#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
+ if (dirname.length() == 2 && dirname[1u] == wxT(':'))
+ dirname << wxT('\\');
+#endif // defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
+
+ if (dirname.empty())
+ dirname = wxFILE_SEP_PATH;
+
+ wxLogNull logNull;
+ wxDir dir(dirname);
+
+ if ( dir.IsOpened() )
+ {
+ wxString dirPrefix(dirname);
+ if (dirPrefix.Last() != wxFILE_SEP_PATH)
+ dirPrefix += wxFILE_SEP_PATH;
+
+ int hiddenFlag = m_showHidden ? wxDIR_HIDDEN : 0;
+
+ bool cont;
+ wxString f;
+
+ // Get the directories first (not matched against wildcards):
+ cont = dir.GetFirst(&f, wxEmptyString, wxDIR_DIRS | hiddenFlag);
+ while (cont)
+ {
+ wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_dir, wxFileIconsTable::folder);
+ if (Add(fd, item) != -1)
+ item.m_itemId++;
+ else
+ delete fd;
+
+ cont = dir.GetNext(&f);
+ }
+
+ // Tokenize the wildcard string, so we can handle more than 1
+ // search pattern in a wildcard.
+ wxStringTokenizer tokenWild(m_wild, wxT(";"));
+ while ( tokenWild.HasMoreTokens() )
+ {
+ cont = dir.GetFirst(&f, tokenWild.GetNextToken(),
+ wxDIR_FILES | hiddenFlag);
+ while (cont)
+ {
+ wxFileData *fd = new wxFileData(dirPrefix + f, f, wxFileData::is_file, wxFileIconsTable::file);
+ if (Add(fd, item) != -1)
+ item.m_itemId++;
+ else
+ delete fd;
+
+ cont = dir.GetNext(&f);
+ }
+ }