rpcs3/rpcs3/Emu/FS/vfsDirBase.cpp
Sacha e8525a6f14 More rFile cleanups and fixes.
Was using fileExists/dirExists before when really should have just been exists. File or Dir doesn't matter and would only create false negatives.
Current working directory shouldn't really be used at all. This is just the folder the application is run from (not even where the .exe resides).
Some of the infos required by vfsLocalDir such as executable may not be portable. Not sure of their intended function as they are never used.
2014-08-01 04:20:00 +10:00

60 lines
826 B
C++

#include "stdafx.h"
#include "vfsDevice.h"
#include "vfsDirBase.h"
vfsDirBase::vfsDirBase(vfsDevice* device)
: m_pos(0)
, m_device(device)
{
}
vfsDirBase::~vfsDirBase()
{
}
bool vfsDirBase::Open(const std::string& path)
{
if(IsOpened())
Close();
if(!IsExists(path))
return false;
m_pos = 0;
m_cwd += '/' + path;
return true;
}
bool vfsDirBase::IsOpened() const
{
return !m_cwd.empty();
}
bool vfsDirBase::IsExists(const std::string& path) const
{
return rExists(path);
}
const std::vector<DirEntryInfo>& vfsDirBase::GetEntries() const
{
return m_entries;
}
void vfsDirBase::Close()
{
m_cwd = "";
m_entries.clear();
}
std::string vfsDirBase::GetPath() const
{
return m_cwd;
}
const DirEntryInfo* vfsDirBase::Read()
{
if (m_pos >= m_entries.size())
return nullptr;
return &m_entries[m_pos++];
}