ResourceFile: Don't rely on finder info being set, even on Macs

This commit is contained in:
Wolfgang Thaller 2015-09-14 23:06:21 +02:00
parent 54591b457a
commit 64e7a15755

View File

@ -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