Managers: add a VFS to BackupManager.

Crashes at runtime. Needs debugging.
This commit is contained in:
Guillaume Jacquemin 2024-07-12 11:37:47 +02:00
parent e11fa34c09
commit e10a2df906
Signed by: williamjcm
SSH key fingerprint: SHA256:AYLOg+iTV0ElElnlu4vqM4edFazVdRiuQB0Y5LoKc4A
2 changed files with 16 additions and 1 deletions

View file

@ -35,7 +35,9 @@
namespace mbst { namespace Managers {
BackupManager::BackupManager() {
BackupManager::BackupManager():
_vfs()
{
refresh();
}
@ -49,6 +51,8 @@ BackupManager::refresh() {
_backups = Containers::Array<Backup>{};
scanSubdir(""_s);
_vfs.build(_backups);
}
Containers::ArrayView<const Backup>
@ -56,6 +60,12 @@ BackupManager::backups() const {
return _backups;
}
const Vfs::VirtualFileSystem<Backup>&
BackupManager::vfs() const
{
return _vfs;
}
bool
BackupManager::create(const GameObjects::Profile& profile) {
if(!profile.valid()) {

View file

@ -25,6 +25,7 @@
#include "Backup.h"
#include "../GameObjects/Profile.h"
#include "Vfs/VirtualFileSystem.h"
using namespace Corrade;
@ -40,6 +41,8 @@ class BackupManager {
auto backups() const -> Containers::ArrayView<const Backup>;
auto vfs() const -> const Vfs::VirtualFileSystem<Backup>&;
bool create(const GameObjects::Profile& profile);
bool remove(std::size_t index);
bool restore(std::size_t index);
@ -50,6 +53,8 @@ class BackupManager {
Containers::String _lastError;
Containers::Array<Backup> _backups;
Vfs::VirtualFileSystem<Backup> _vfs;
};
}}