mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06: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:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user