diff options
| author | JosJuice <josjuice@gmail.com> | 2016-12-21 12:50:15 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2017-01-11 13:23:23 +0100 |
| commit | 8d54bbc52803a2e665e58a8a9b1b22182c7f0027 (patch) | |
| tree | df5c22ea2053d03d43bab4fdee3d7fbdecff9de8 /Source/Core/DiscIO/FileBlob.cpp | |
| parent | d1ea00ed884cf714a252d3194d3f8dbdc54ac937 (diff) | |
Don't create new IOFiles when creating a blob
...except for WBFS, which is special because
it has the ability to open multiple files.
Diffstat (limited to 'Source/Core/DiscIO/FileBlob.cpp')
| -rw-r--r-- | Source/Core/DiscIO/FileBlob.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/FileBlob.cpp b/Source/Core/DiscIO/FileBlob.cpp index 7d1dabe198..3547ef658d 100644 --- a/Source/Core/DiscIO/FileBlob.cpp +++ b/Source/Core/DiscIO/FileBlob.cpp @@ -2,22 +2,23 @@ // Licensed under GPLv2+ // Refer to the license.txt file included. -#include "DiscIO/FileBlob.h" #include <memory> #include <string> +#include <utility> + +#include "DiscIO/FileBlob.h" namespace DiscIO { -PlainFileReader::PlainFileReader(std::FILE* file) : m_file(file) +PlainFileReader::PlainFileReader(File::IOFile file) : m_file(std::move(file)) { m_size = m_file.GetSize(); } -std::unique_ptr<PlainFileReader> PlainFileReader::Create(const std::string& filename) +std::unique_ptr<PlainFileReader> PlainFileReader::Create(File::IOFile file) { - File::IOFile f(filename, "rb"); - if (f) - return std::unique_ptr<PlainFileReader>(new PlainFileReader(f.ReleaseHandle())); + if (file) + return std::unique_ptr<PlainFileReader>(new PlainFileReader(std::move(file))); return nullptr; } |
