Implement FS_User::GetFreeBytes
This commit is contained in:
parent
04325e5980
commit
5dfd2dba70
8 changed files with 60 additions and 1 deletions
|
@ -131,6 +131,12 @@ public:
|
|||
* @return Opened directory, or nullptr
|
||||
*/
|
||||
virtual std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const = 0;
|
||||
|
||||
/**
|
||||
* Get the free space
|
||||
* @return The number of free bytes in the archive
|
||||
*/
|
||||
virtual u64 GetFreeBytes() const = 0;
|
||||
};
|
||||
|
||||
class ArchiveFactory : NonCopyable {
|
||||
|
|
|
@ -74,6 +74,11 @@ std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) c
|
|||
return std::move(directory);
|
||||
}
|
||||
|
||||
u64 DiskArchive::GetFreeBytes() const {
|
||||
// TODO: Stubbed to return 1GiB
|
||||
return 1024 * 1024 * 1024;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DiskFile::DiskFile(const DiskArchive& archive, const Path& path, const Mode mode) {
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
bool CreateDirectory(const Path& path) const override;
|
||||
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
|
||||
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
||||
u64 GetFreeBytes() const override;
|
||||
|
||||
protected:
|
||||
friend class DiskFile;
|
||||
|
|
|
@ -59,6 +59,11 @@ std::unique_ptr<DirectoryBackend> IVFCArchive::OpenDirectory(const Path& path) c
|
|||
return Common::make_unique<IVFCDirectory>();
|
||||
}
|
||||
|
||||
u64 IVFCArchive::GetFreeBytes() const {
|
||||
LOG_WARNING(Service_FS, "Attempted to get the free space in an IVFC archive");
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
size_t IVFCFile::Read(const u64 offset, const size_t length, u8* buffer) const {
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
bool CreateDirectory(const Path& path) const override;
|
||||
bool RenameDirectory(const Path& src_path, const Path& dest_path) const override;
|
||||
std::unique_ptr<DirectoryBackend> OpenDirectory(const Path& path) const override;
|
||||
u64 GetFreeBytes() const override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<FileUtil::IOFile> romfs_file;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue