- Set the executable flag for some files in _stat.

svn path=/trunk/; revision=4415
This commit is contained in:
Hartmut Birr 2003-03-23 15:18:34 +00:00
parent fa9eae54dd
commit f771a79dd9

View file

@ -12,6 +12,7 @@ int _stat(const char* path, struct stat* buffer)
{
HANDLE findHandle;
WIN32_FIND_DATAA findData;
char* ext;
if (!buffer)
{
@ -46,7 +47,15 @@ int _stat(const char* path, struct stat* buffer)
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
buffer->st_mode |= S_IFDIR;
else
{
buffer->st_mode |= S_IFREG;
ext = strrchr(path, '.');
if (ext && (!stricmp(ext, ".exe") ||
!stricmp(ext, ".com") ||
!stricmp(ext, ".bat") ||
!stricmp(ext, ".cmd")))
buffer->st_mode |= S_IEXEC;
}
if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_READONLY))
buffer->st_mode |= S_IWRITE;