DiscIO: Use Common::Lazy for loading filesystems

This simplifies FileMonitor a lot and also lets us
clean up FilesystemPanel.
This commit is contained in:
JosJuice
2017-08-02 18:16:56 +02:00
parent 0d07821935
commit 38304da947
21 changed files with 182 additions and 172 deletions

View File

@ -109,8 +109,7 @@ public:
FileSystem(const Volume* volume, const Partition& partition);
virtual ~FileSystem();
// If IsValid is false, GetRoot must not be called. CreateFileSystem
// takes care of this automatically, so other code is recommended to use it.
// If IsValid is false, GetRoot must not be called.
virtual bool IsValid() const = 0;
// The object returned by GetRoot and all objects created from it
// are only valid for as long as the file system object is valid.
@ -126,7 +125,8 @@ protected:
const Partition m_partition;
};
// Returns nullptr if a valid file system could not be created
std::unique_ptr<FileSystem> CreateFileSystem(const Volume* volume, const Partition& partition);
// Calling Volume::GetFileSystem instead of manually constructing a filesystem is recommended,
// because it will check IsValid for you, will automatically pick the right type of filesystem,
// and will cache the filesystem in case it's needed again later.
} // namespace