Review Fixes

This commit is contained in:
Zach Hilman
2018-07-22 23:41:00 -04:00
parent 22975f64fe
commit 172a651a29
2 changed files with 6 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ enum class Mode : u32 {
Write = 2,
ReadWrite = 3,
Append = 4,
WriteAppend = 6,
};
} // namespace FileSys

View File

@@ -62,11 +62,11 @@ std::shared_ptr<VfsDirectory> RealVfsFile::GetContainingDirectory() const {
}
bool RealVfsFile::IsWritable() const {
return perms == Mode::Append || perms == Mode::Write;
return static_cast<u32>(perms) & static_cast<u32>(Mode::WriteAppend);
}
bool RealVfsFile::IsReadable() const {
return perms == Mode::Read || perms == Mode::Write;
return static_cast<u32>(perms) & static_cast<u32>(Mode::ReadWrite);
}
size_t RealVfsFile::Read(u8* data, size_t length, size_t offset) const {
@@ -102,8 +102,7 @@ RealVfsDirectory::RealVfsDirectory(const std::string& path_, Mode perms_)
path_components(FileUtil::SplitPathComponents(path)),
parent_components(FileUtil::SliceVector(path_components, 0, path_components.size() - 1)),
perms(perms_) {
// Write|Append
if (!FileUtil::Exists(path) && (static_cast<u32>(perms) & 0x6) > 0)
if (!FileUtil::Exists(path) && (static_cast<u32>(perms) & static_cast<u32>(Mode::WriteAppend)))
FileUtil::CreateDir(path);
if (perms == Mode::Append)
@@ -130,11 +129,11 @@ std::vector<std::shared_ptr<VfsDirectory>> RealVfsDirectory::GetSubdirectories()
}
bool RealVfsDirectory::IsWritable() const {
return perms == Mode::Write || perms == Mode::Append;
return static_cast<u32>(perms) & static_cast<u32>(Mode::WriteAppend);
}
bool RealVfsDirectory::IsReadable() const {
return perms == Mode::Read || perms == Mode::Write;
return static_cast<u32>(perms) & static_cast<u32>(Mode::ReadWrite);
}
std::string RealVfsDirectory::GetName() const {