2013-06-30 10:46:29 +02:00
|
|
|
#include "stdafx.h"
|
2013-11-19 11:30:58 +01:00
|
|
|
#include "vfsDirBase.h"
|
2013-06-30 10:46:29 +02:00
|
|
|
|
2014-02-02 20:42:32 +01:00
|
|
|
vfsDirBase::vfsDirBase(const wxString& path)
|
|
|
|
|
{
|
|
|
|
|
Open(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vfsDirBase::~vfsDirBase()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool vfsDirBase::Open(const wxString& path)
|
|
|
|
|
{
|
|
|
|
|
if(!IsOpened())
|
|
|
|
|
Close();
|
|
|
|
|
|
|
|
|
|
if(!IsExists(path))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
m_cwd += '/' + path;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool vfsDirBase::IsOpened() const
|
|
|
|
|
{
|
|
|
|
|
return !m_cwd.IsEmpty();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-09 22:53:48 +01:00
|
|
|
bool vfsDirBase::IsExists(const wxString& path) const
|
2014-02-02 20:42:32 +01:00
|
|
|
{
|
2014-02-09 22:53:48 +01:00
|
|
|
return wxDirExists(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Array<DirEntryInfo>& vfsDirBase::GetEntries() const
|
|
|
|
|
{
|
|
|
|
|
return m_entries;
|
2014-02-02 20:42:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void vfsDirBase::Close()
|
|
|
|
|
{
|
|
|
|
|
m_cwd = wxEmptyString;
|
2014-02-09 22:53:48 +01:00
|
|
|
m_entries.Clear();
|
2014-02-02 20:42:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wxString vfsDirBase::GetPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_cwd;
|
|
|
|
|
}
|