mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-12-06 07:12:14 +01:00
67 lines
1.3 KiB
C++
67 lines
1.3 KiB
C++
#include "stdafx.h"
|
|
#include "vfsDevice.h"
|
|
#include "vfsLocalDir.h"
|
|
|
|
vfsLocalDir::vfsLocalDir(vfsDevice* device) : vfsDirBase(device)
|
|
{
|
|
}
|
|
|
|
vfsLocalDir::~vfsLocalDir()
|
|
{
|
|
}
|
|
|
|
bool vfsLocalDir::Open(const std::string& path)
|
|
{
|
|
if (!vfsDirBase::Open(path) || !dir.Open(path))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
std::string name;
|
|
|
|
for (bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name))
|
|
{
|
|
FileInfo file_info;
|
|
get_file_info(path + "/" + name, file_info);
|
|
|
|
m_entries.emplace_back();
|
|
|
|
DirEntryInfo& info = m_entries.back();
|
|
|
|
info.name = name;
|
|
info.flags |= file_info.isDirectory ? DirEntry_TypeDir | DirEntry_PermExecutable : DirEntry_TypeFile;
|
|
info.flags |= file_info.isWritable ? DirEntry_PermWritable | DirEntry_PermReadable : DirEntry_PermReadable;
|
|
info.size = file_info.size;
|
|
info.access_time = file_info.atime;
|
|
info.modify_time = file_info.mtime;
|
|
info.create_time = file_info.ctime;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool vfsLocalDir::Create(const std::string& path)
|
|
{
|
|
return rMkdir(path);
|
|
}
|
|
|
|
bool vfsLocalDir::IsExists(const std::string& path) const
|
|
{
|
|
return rIsDir(path);
|
|
}
|
|
|
|
bool vfsLocalDir::Rename(const std::string& from, const std::string& to)
|
|
{
|
|
return rRename(from, to);
|
|
}
|
|
|
|
bool vfsLocalDir::Remove(const std::string& path)
|
|
{
|
|
return rRmdir(path);
|
|
}
|
|
|
|
bool vfsLocalDir::IsOpened() const
|
|
{
|
|
return dir.IsOpened() && vfsDirBase::IsOpened();
|
|
}
|