mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-08 22:30:25 +00:00
TEXT file type is a text file
This commit is contained in:
parent
7c127931e1
commit
541ac7fc29
@ -96,6 +96,17 @@ namespace OS
|
||||
// known text file extensions
|
||||
bool IsTextFile(const std::string &s)
|
||||
{
|
||||
|
||||
// 1. check for a TEXT file type.
|
||||
{
|
||||
int rv;
|
||||
char buffer[32];
|
||||
|
||||
rv = ::getxattr(s.c_str(), XATTR_FINDERINFO_NAME, buffer, 32, 0, 0);
|
||||
if (rv >= 8 && memcmp(buffer, "TEXT", 4) == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string ext = extension(s);
|
||||
if (ext.empty()) return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user