mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-25 15:31:17 +01:00
Made filesystem viewer to show folders and subfolders right. Only bug remaining (supposed to be simple) is that after the first folder recursion the searching stops.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@826 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
08984104d7
commit
15c3ea50fc
@ -51,14 +51,11 @@ CFilesystemViewer::CFilesystemViewer(const std::string fileName, wxWindow* paren
|
|||||||
CreateGUIControls();
|
CreateGUIControls();
|
||||||
|
|
||||||
// shuffle2: things only appear in the tree for me when using debug build; why? :<
|
// shuffle2: things only appear in the tree for me when using debug build; why? :<
|
||||||
// TODO: make proper looking dirs
|
|
||||||
wxTreeItemId dirId = NULL;
|
wxTreeItemId dirId = NULL;
|
||||||
for(u32 a = 1; a < Our_Files.size(); ++a)
|
fileIter beginning = Our_Files.begin(), pos = Our_Files.begin();
|
||||||
{
|
|
||||||
m_Treectrl->AppendItem(RootId, wxString::Format(_T("%s"), Our_Files[a]->m_FullPath));
|
CreateDirectoryTree(RootId, beginning, pos, "\\");
|
||||||
|
|
||||||
//if(Our_Files[a]->IsDirectory())
|
|
||||||
}
|
|
||||||
m_Treectrl->Expand(RootId);
|
m_Treectrl->Expand(RootId);
|
||||||
|
|
||||||
// Disk header and apploader
|
// Disk header and apploader
|
||||||
@ -99,6 +96,40 @@ CFilesystemViewer::~CFilesystemViewer()
|
|||||||
delete OpenISO;
|
delete OpenISO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFilesystemViewer::CreateDirectoryTree(wxTreeItemId& parent,
|
||||||
|
fileIter& begin,
|
||||||
|
fileIter& iterPos,
|
||||||
|
char *directory)
|
||||||
|
{
|
||||||
|
//TODO(XK): Fix more than one folder/file not appearing in the root
|
||||||
|
if(iterPos == begin)
|
||||||
|
++iterPos;
|
||||||
|
|
||||||
|
char *name = (char *)((*iterPos)->m_FullPath);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if((*iterPos)->IsDirectory()) {
|
||||||
|
char *dirName;
|
||||||
|
name[strlen(name) - 1] = '\0';
|
||||||
|
dirName = strrchr(name, '\\');
|
||||||
|
if(!dirName)
|
||||||
|
dirName = name;
|
||||||
|
else
|
||||||
|
dirName++;
|
||||||
|
//filename = strrchr(name, '\\'); ++filename;
|
||||||
|
wxTreeItemId item = m_Treectrl->AppendItem(parent, wxT(dirName));
|
||||||
|
CreateDirectoryTree(item, begin, ++iterPos, name);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//filename = strrchr(name, '\\'); ++filename;
|
||||||
|
m_Treectrl->AppendItem(parent, wxT(strrchr(name, '\\') + 1));
|
||||||
|
}
|
||||||
|
++iterPos;
|
||||||
|
name = (char *)((*iterPos)->m_FullPath);
|
||||||
|
} while(strstr(name, directory));
|
||||||
|
}
|
||||||
|
|
||||||
void CFilesystemViewer::CreateGUIControls()
|
void CFilesystemViewer::CreateGUIControls()
|
||||||
{
|
{
|
||||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include <wx/treectrl.h>
|
#include <wx/treectrl.h>
|
||||||
#include <wx/gbsizer.h>
|
#include <wx/gbsizer.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "Filesystem.h"
|
||||||
|
|
||||||
#undef FILESYSTEM_VIEWER_STYLE
|
#undef FILESYSTEM_VIEWER_STYLE
|
||||||
#define FILESYSTEM_VIEWER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
|
#define FILESYSTEM_VIEWER_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
|
||||||
@ -132,6 +134,11 @@ class CFilesystemViewer : public wxDialog
|
|||||||
void OnExtractFile(wxCommandEvent& event);
|
void OnExtractFile(wxCommandEvent& event);
|
||||||
void OnReplaceFile(wxCommandEvent& event);
|
void OnReplaceFile(wxCommandEvent& event);
|
||||||
void OnRenameFile(wxCommandEvent& event);
|
void OnRenameFile(wxCommandEvent& event);
|
||||||
|
|
||||||
|
typedef std::vector<const DiscIO::SFileInfo *>::iterator fileIter;
|
||||||
|
|
||||||
|
void CreateDirectoryTree(wxTreeItemId& parent,fileIter& begin,
|
||||||
|
fileIter& iterPos, char *directory);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user