feat: Do not save memory providers as recent entries (#1259)
This commit is contained in:
parent
a1dc979217
commit
175e66a60e
@ -61,6 +61,12 @@ namespace hex::prv {
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] virtual bool isDumpable() const;
|
[[nodiscard]] virtual bool isDumpable() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Controls whether this provider can be saved as a recent entry
|
||||||
|
* Tipitcally used for providers that do not retain data, e.g. the memory provider
|
||||||
|
*/
|
||||||
|
[[nodiscard]] virtual bool isSavableAsRecent() const { return true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read data from this provider, applying overlays and patches
|
* @brief Read data from this provider, applying overlays and patches
|
||||||
* @param offset offset to start reading the data
|
* @param offset offset to start reading the data
|
||||||
|
@ -15,6 +15,7 @@ namespace hex::plugin::builtin {
|
|||||||
[[nodiscard]] bool isWritable() const override { return !this->m_readOnly; }
|
[[nodiscard]] bool isWritable() const override { return !this->m_readOnly; }
|
||||||
[[nodiscard]] bool isResizable() const override { return !this->m_readOnly; }
|
[[nodiscard]] bool isResizable() const override { return !this->m_readOnly; }
|
||||||
[[nodiscard]] bool isSavable() const override { return this->m_name.empty(); }
|
[[nodiscard]] bool isSavable() const override { return this->m_name.empty(); }
|
||||||
|
[[nodiscard]] bool isSavableAsRecent() const override { return false; }
|
||||||
|
|
||||||
[[nodiscard]] bool open() override;
|
[[nodiscard]] bool open() override;
|
||||||
void close() override { }
|
void close() override { }
|
||||||
|
@ -33,6 +33,9 @@ namespace hex::plugin::builtin::recent {
|
|||||||
// do not save to recents if the provider is part of a project
|
// do not save to recents if the provider is part of a project
|
||||||
if (ProjectFile::hasPath()) return;
|
if (ProjectFile::hasPath()) return;
|
||||||
|
|
||||||
|
// do not save to recents if the provider doesnt want it
|
||||||
|
if (!provider->isSavableAsRecent()) return;
|
||||||
|
|
||||||
// The recent provider is saved to every "recent" directory
|
// The recent provider is saved to every "recent" directory
|
||||||
for (const auto &recentPath : fs::getDefaultPaths(fs::ImHexPath::Recent)) {
|
for (const auto &recentPath : fs::getDefaultPaths(fs::ImHexPath::Recent)) {
|
||||||
wolv::io::File recentFile(recentPath / fileName, wolv::io::File::Mode::Create);
|
wolv::io::File recentFile(recentPath / fileName, wolv::io::File::Mode::Create);
|
||||||
|
Loading…
Reference in New Issue
Block a user