fs::dir implemented, bugfixes

This commit is contained in:
Nekotekina 2015-04-25 22:15:53 +03:00
parent d18d19870f
commit 02ca97804e
6 changed files with 269 additions and 156 deletions

View file

@ -12,18 +12,16 @@ vfsLocalDir::~vfsLocalDir()
bool vfsLocalDir::Open(const std::string& path)
{
if (!vfsDirBase::Open(path) || !dir.Open(path))
if (!vfsDirBase::Open(path) || !m_dir.open(path))
{
return false;
}
std::string name;
fs::stat_t file_info;
for (bool is_ok = dir.GetFirst(&name); is_ok; is_ok = dir.GetNext(&name))
for (bool is_ok = m_dir.get_first(name, file_info); is_ok; is_ok = m_dir.get_next(name, file_info))
{
fs::stat_t file_info;
fs::stat(path + "/" + name, file_info);
m_entries.emplace_back();
DirEntryInfo& info = m_entries.back();
@ -62,5 +60,5 @@ bool vfsLocalDir::Remove(const std::string& path)
bool vfsLocalDir::IsOpened() const
{
return dir.IsOpened() && vfsDirBase::IsOpened();
return m_dir && vfsDirBase::IsOpened();
}

View file

@ -6,7 +6,7 @@ class vfsLocalDir : public vfsDirBase
{
private:
u32 m_pos;
rDir dir;
fs::dir m_dir;
public:
vfsLocalDir(vfsDevice* device);
@ -19,4 +19,4 @@ public:
virtual bool Remove(const std::string& path) override;
virtual bool IsOpened() const override;
virtual bool IsExists(const std::string& path) const;
};
};

View file

@ -374,7 +374,10 @@ __noinline s32 savedata_op(
Emu.GetVFS().GetDevice(dir_path, dir_local_path);
fs::stat_t dir_info;
fs::stat(dir_local_path, dir_info);
if (!fs::stat(dir_local_path, dir_info))
{
// error
}
statGet->hddFreeSizeKB = 40 * 1024 * 1024; // 40 GB
statGet->isNewData = save_entry.isNew = !psf;

View file

@ -249,7 +249,7 @@ s32 sys_fs_stat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
fs::stat_t info;
if (!fs::stat(local_path, info) || !info.exists)
if (!fs::stat(local_path, info))
{
sys_fs.Error("sys_fs_stat('%s') failed: not found", path.get_ptr());
return CELL_FS_ENOENT;