Do application reset on first store_or_update
This commit is contained in:
parent
385150ab6b
commit
24bd4f69a1
2 changed files with 6 additions and 3 deletions
|
|
@ -25,13 +25,15 @@ namespace application {
|
||||||
const Database::Item Database::Unknown{};
|
const Database::Item Database::Unknown{};
|
||||||
|
|
||||||
Database::Database() :
|
Database::Database() :
|
||||||
storage_(std::make_shared<LauncherStorage>(SystemConfiguration::instance().application_item_dir())) {
|
storage_(std::make_shared<LauncherStorage>(SystemConfiguration::instance().application_item_dir())) {}
|
||||||
storage_->reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
Database::~Database() {}
|
Database::~Database() {}
|
||||||
|
|
||||||
void Database::store_or_update(const Item &item) {
|
void Database::store_or_update(const Item &item) {
|
||||||
|
if (!done_reset) {
|
||||||
|
storage_->reset();
|
||||||
|
done_reset = true;
|
||||||
|
}
|
||||||
storage_->add_or_update(item);
|
storage_->add_or_update(item);
|
||||||
items_[item.package] = item;
|
items_[item.package] = item;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ class Database {
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<LauncherStorage> storage_;
|
std::shared_ptr<LauncherStorage> storage_;
|
||||||
std::map<std::string,Item> items_;
|
std::map<std::string,Item> items_;
|
||||||
|
bool done_reset = false;
|
||||||
};
|
};
|
||||||
} // namespace application
|
} // namespace application
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue