mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 13:56:27 -05:00
a25d79cfaa
When writing VFS, it initally seemed useful to include a function to in-place convert container files into directories in one homogenous directory structure, but re-evaluating it now there have been plenty of chances to use it and there has always been a better way. Removing as it is unused and likely will not be used.
47 lines
1.9 KiB
C++
47 lines
1.9 KiB
C++
// Copyright 2018 yuzu emulator team
|
|
// Licensed under GPLv2 or any later version
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include "core/file_sys/vfs.h"
|
|
|
|
namespace FileSys {
|
|
|
|
// Class that stacks multiple VfsDirectories on top of each other, attempting to read from the first
|
|
// one and falling back to the one after. The highest priority directory (overwrites all others)
|
|
// should be element 0 in the dirs vector.
|
|
class LayeredVfsDirectory : public VfsDirectory {
|
|
LayeredVfsDirectory(std::vector<VirtualDir> dirs, std::string name);
|
|
|
|
public:
|
|
~LayeredVfsDirectory() override;
|
|
|
|
/// Wrapper function to allow for more efficient handling of dirs.size() == 0, 1 cases.
|
|
static VirtualDir MakeLayeredDirectory(std::vector<VirtualDir> dirs, std::string name = "");
|
|
|
|
std::shared_ptr<VfsFile> GetFileRelative(std::string_view path) const override;
|
|
std::shared_ptr<VfsDirectory> GetDirectoryRelative(std::string_view path) const override;
|
|
std::shared_ptr<VfsFile> GetFile(std::string_view name) const override;
|
|
std::shared_ptr<VfsDirectory> GetSubdirectory(std::string_view name) const override;
|
|
std::string GetFullPath() const override;
|
|
|
|
std::vector<std::shared_ptr<VfsFile>> GetFiles() const override;
|
|
std::vector<std::shared_ptr<VfsDirectory>> GetSubdirectories() const override;
|
|
bool IsWritable() const override;
|
|
bool IsReadable() const override;
|
|
std::string GetName() const override;
|
|
std::shared_ptr<VfsDirectory> GetParentDirectory() const override;
|
|
std::shared_ptr<VfsDirectory> CreateSubdirectory(std::string_view name) override;
|
|
std::shared_ptr<VfsFile> CreateFile(std::string_view name) override;
|
|
bool DeleteSubdirectory(std::string_view name) override;
|
|
bool DeleteFile(std::string_view name) override;
|
|
bool Rename(std::string_view name) override;
|
|
|
|
private:
|
|
std::vector<VirtualDir> dirs;
|
|
std::string name;
|
|
};
|
|
|
|
} // namespace FileSys
|