RFD: deprecate permissions-related stuff in System.Directory
Simon Marlow
simonmarhaskell at gmail.com
Fri Aug 31 04:01:39 EDT 2007
Neil Mitchell wrote:
>> returns True for execute permission on Windows, and the one in GHC 6.8.1
>> returns True if the filename ends in something like ".exe" or ".bat" (both
>> are wrong, just wrong in different ways).
>
> The GHC one is pretty wrong, since ".com" is also a valid extension
> for executables.
Um, I said "something like ...". The code in fact is Microsoft's
implementation of stat(), in the CRT. The list it uses is:
/* see if file appears to be executable - check extension of name */
if (p = _tcsrchr(name, _T('.'))) {
if ( !_tcsicmp(p, _T(".exe")) ||
!_tcsicmp(p, _T(".cmd")) ||
!_tcsicmp(p, _T(".bat")) ||
!_tcsicmp(p, _T(".com")) )
uxmode |= _S_IEXEC;
}
Cheers,
Simon
More information about the Libraries
mailing list