2014-02-16 16:19:06 +01:00
|
|
|
#include "stdafx.h"
|
2014-06-17 17:44:03 +02:00
|
|
|
#include "Utilities/Log.h"
|
2014-06-02 19:27:24 +02:00
|
|
|
#include "Emu/Memory/Memory.h"
|
|
|
|
|
#include "Emu/System.h"
|
|
|
|
|
|
2014-02-16 16:19:06 +01:00
|
|
|
#include "vfsDir.h"
|
|
|
|
|
|
|
|
|
|
vfsDir::vfsDir()
|
|
|
|
|
: vfsDirBase(nullptr)
|
|
|
|
|
, m_stream(nullptr)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
vfsDir::vfsDir(const std::string& path)
|
2014-02-16 16:19:06 +01:00
|
|
|
: vfsDirBase(nullptr)
|
|
|
|
|
, m_stream(nullptr)
|
|
|
|
|
{
|
|
|
|
|
Open(path);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
bool vfsDir::Open(const std::string& path)
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
|
|
|
|
Close();
|
|
|
|
|
|
2014-02-16 16:37:32 +01:00
|
|
|
m_stream.reset(Emu.GetVFS().OpenDir(path));
|
2014-02-16 16:19:06 +01:00
|
|
|
|
|
|
|
|
return m_stream && m_stream->IsOpened();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
bool vfsDir::Create(const std::string& path)
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
|
|
|
|
return m_stream->Create(path);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
bool vfsDir::IsExists(const std::string& path) const
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
2014-03-01 09:38:50 +01:00
|
|
|
return m_stream->IsExists(path); // Crash (Access violation reading location 0x0000000000000000)
|
2014-02-16 16:19:06 +01:00
|
|
|
}
|
|
|
|
|
|
2014-04-10 00:54:32 +02:00
|
|
|
const std::vector<DirEntryInfo>& vfsDir::GetEntries() const
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
|
|
|
|
return m_stream->GetEntries();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
bool vfsDir::Rename(const std::string& from, const std::string& to)
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
|
|
|
|
return m_stream->Rename(from, to);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
bool vfsDir::Remove(const std::string& path)
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
|
|
|
|
return m_stream->Remove(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const DirEntryInfo* vfsDir::Read()
|
|
|
|
|
{
|
|
|
|
|
return m_stream->Read();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void vfsDir::Close()
|
|
|
|
|
{
|
|
|
|
|
m_stream.reset();
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-01 02:33:55 +02:00
|
|
|
std::string vfsDir::GetPath() const
|
2014-02-16 16:19:06 +01:00
|
|
|
{
|
|
|
|
|
return m_stream->GetPath();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool vfsDir::IsOpened() const
|
|
|
|
|
{
|
2014-02-22 03:53:06 +01:00
|
|
|
return m_stream && m_stream->IsOpened();
|
2014-02-16 16:19:06 +01:00
|
|
|
}
|