mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 20:28:56 +00:00
Don't create new IOFiles when creating a blob
...except for WBFS, which is special because it has the ability to open multiple files.
This commit is contained in:
parent
d1ea00ed88
commit
8d54bbc528
10 changed files with 93 additions and 80 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue