[IronPython] os.access

Slide slide.o.mix at gmail.com
Mon Jan 29 02:06:00 CET 2007


On 1/28/07, J. Merrill <jvm_cop at spamcop.net> wrote:
> The CRT (C-language runtime) is not available to .Net code (except through unmanaged code), so it's not as simple to do this as just P/Invoking that routine.
>
> Unfortunately the pointer in the page you mention below to the .Net equivalent doesn't point to the description of code that does the equivalent thing; it points to the definition of an enumeration that needs to be used in the implementation of a method equivalent to access().
>
> At 09:20 AM 1/27/2007, Sanghyeon Seo wrote (in part)
> >It would be nice to have a basic implementation of os.access in IronPython.
> >[snip]
> >CPython simply calls access() function of CRT to implement it on Windows:
> >http://msdn2.microsoft.com/en-us/library/1w06ktdy(VS.80).aspx
> >
> >--
> >Seo Sanghyeon
>
>

After following through some of the links on the page for the access
function, wouldn't the System.IO.FileInfo class with its .Exists,
.IsReadOnly, etc members come the closest in functionality? I don't
know how you would do write only, but if you figured that out, you
could find out read and write as well. access also works on
directories as well, so you might have to go with
System.IO.FileSystemInfo, or check whether the item was a directory or
file before checking the access.

slide



More information about the Ironpython-users mailing list