1
0
mirror of synced 2025-01-31 03:53:44 +01:00

fix: Make sure files don't get truncated when using Save As on itself

Fixes #987
This commit is contained in:
WerWolv 2023-03-21 15:42:10 +01:00
parent b9059aaa01
commit be16b66ac0
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,7 @@ namespace hex::plugin::builtin {
[[nodiscard]] size_t getActualSize() const override;
void save() override;
void saveAs(const std::fs::path &path) override;
[[nodiscard]] std::string getName() const override;
[[nodiscard]] std::vector<std::pair<std::string, std::string>> getDataDescription() const override;

View File

@ -84,6 +84,13 @@ namespace hex::plugin::builtin {
this->applyPatches();
}
void FileProvider::saveAs(const std::fs::path &path) {
if (path == this->m_path)
this->save();
else
Provider::saveAs(path);
}
void FileProvider::resize(size_t newSize) {
this->close();