+ if (m_path == wxT("~"))
+ wxGetHomeDir( &m_path );
+
+ // choose the directory corresponding to defaultPath in the tree
+ // VZ: using wxStringTokenizer is probably unsafe here (escaped slashes
+ // will not be processed correctly...)
+ wxStringTokenizer tk(m_path, wxFILE_SEP_PATH, wxTOKEN_STRTOK);
+
+ wxString path;
+
+ long cookie = 0;
+ // default to root dir
+ wxTreeItemId item = m_dir->GetFirstChild(m_dir->GetRootItem(), cookie);
+
+ if (!m_path.IsEmpty() && (m_path != wxT("/")) && (m_dir->m_paths.Count() > 1))
+ {
+ size_t count = m_dir->m_paths.GetCount();
+ for ( size_t i=1; i<count; i++)
+ {
+ if (m_path.Find( m_dir->m_paths[i] ) == 0)
+ {
+ path = m_dir->m_paths[i];
+
+ for (size_t j = 0; j < i; j++)
+ item = m_dir->GetNextChild(m_dir->GetRootItem(), cookie);
+
+ wxStringTokenizer tk2(path, wxFILE_SEP_PATH, wxTOKEN_STRTOK);
+ for (size_t h = 0; h < tk2.CountTokens(); h++)
+ tk.GetNextToken();
+
+ break;
+ }
+ }
+ }
+ while ( tk.HasMoreTokens() && item.IsOk() )
+ {
+ path << wxFILE_SEP_PATH << tk.GetNextToken();
+
+ m_dir->Expand(item);
+
+ wxTreeItemId child = m_dir->GetFirstChild(item, cookie);
+ while ( child.IsOk() )
+ {
+ wxDirItemData *data = (wxDirItemData*)m_dir->GetItemData(child);
+ if ( data->m_path == path )
+ break;
+
+ child = m_dir->GetNextChild(item, cookie);
+ }
+
+ item = child;
+ }
+
+ if ( item.IsOk() )
+ {
+ m_dir->Expand(item);
+ m_dir->SelectItem(item);
+ m_dir->EnsureVisible(item);
+ }
+