From 64e7a157557778cfc2455a151874f89663a01aca Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Mon, 14 Sep 2015 23:06:21 +0200 Subject: [PATCH] ResourceFile: Don't rely on finder info being set, even on Macs --- ResourceFiles/ResourceFile.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ResourceFiles/ResourceFile.cc b/ResourceFiles/ResourceFile.cc index d1bc05f387..1b4e1d5585 100644 --- a/ResourceFiles/ResourceFile.cc +++ b/ResourceFiles/ResourceFile.cc @@ -173,6 +173,8 @@ bool ResourceFile::read() { fs::path path(pathstring); + type = creator = 0x3F3F3F3F; + switch(format) { case Format::basilisk: @@ -200,10 +202,12 @@ bool ResourceFile::read() char finf[32]; int n = getxattr(path.c_str(), XATTR_FINDERINFO_NAME, finf, 32, 0, 0); - - std::istringstream finfIn(std::string(finf, finf+n)); - type = ostype(finfIn); - creator = ostype(finfIn); + if(n > 0) + { + std::istringstream finfIn(std::string(finf, finf+n)); + type = ostype(finfIn); + creator = ostype(finfIn); + } } break; #endif