mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-29 12:50:35 +00:00
ResourceFile: error handling...
This commit is contained in:
parent
687fd2a779
commit
9a50b29581
@ -217,11 +217,14 @@ bool ResourceFile::read()
|
|||||||
case Format::basilisk:
|
case Format::basilisk:
|
||||||
{
|
{
|
||||||
fs::ifstream dataIn(path);
|
fs::ifstream dataIn(path);
|
||||||
|
if(!dataIn)
|
||||||
|
return false;
|
||||||
data = std::string(std::istreambuf_iterator<char>(dataIn),
|
data = std::string(std::istreambuf_iterator<char>(dataIn),
|
||||||
std::istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
|
|
||||||
fs::ifstream rsrcIn(path.parent_path() / ".rsrc" / path.filename());
|
fs::ifstream rsrcIn(path.parent_path() / ".rsrc" / path.filename());
|
||||||
resources = Resources(rsrcIn);
|
if(rsrcIn)
|
||||||
|
resources = Resources(rsrcIn);
|
||||||
fs::ifstream finfIn(path.parent_path() / ".finf" / path.filename());
|
fs::ifstream finfIn(path.parent_path() / ".finf" / path.filename());
|
||||||
if(finfIn)
|
if(finfIn)
|
||||||
{
|
{
|
||||||
@ -234,10 +237,13 @@ bool ResourceFile::read()
|
|||||||
case Format::real:
|
case Format::real:
|
||||||
{
|
{
|
||||||
fs::ifstream dataIn(path);
|
fs::ifstream dataIn(path);
|
||||||
|
if(!dataIn)
|
||||||
|
return false;
|
||||||
data = std::string(std::istreambuf_iterator<char>(dataIn),
|
data = std::string(std::istreambuf_iterator<char>(dataIn),
|
||||||
std::istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
fs::ifstream rsrcIn(path / "..namedfork" / "rsrc");
|
fs::ifstream rsrcIn(path / "..namedfork" / "rsrc");
|
||||||
resources = Resources(rsrcIn);
|
if(rsrcIn)
|
||||||
|
resources = Resources(rsrcIn);
|
||||||
|
|
||||||
char finf[32];
|
char finf[32];
|
||||||
int n = getxattr(path.c_str(), XATTR_FINDERINFO_NAME,
|
int n = getxattr(path.c_str(), XATTR_FINDERINFO_NAME,
|
||||||
|
Loading…
Reference in New Issue
Block a user