1
0
mirror of synced 2024-11-28 09:30:51 +01:00

utils: Fix file wrapper

This commit is contained in:
WerWolv 2021-09-12 20:26:39 +02:00
parent 3cd177bff2
commit ea2d181741
2 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,9 @@ namespace hex {
explicit File(const std::string &path, Mode mode);
File();
File(const File&) = delete;
File(File &&other) noexcept;
~File();
bool isValid() { return this->m_file != nullptr; }

View File

@ -17,6 +17,11 @@ namespace hex {
this->m_file = nullptr;
}
File::File(File &&other) noexcept {
this->m_file = other.m_file;
other.m_file = nullptr;
}
File::~File() {
if (isValid())
fclose(this->m_file);