DÅ?a Utorok 07 FebruÃ¡r 2006 20:49 Chris napÃsal:
This problem comes up because WinXP keeps putting it’s ‘System Volume
Information’ directories on each partition. In this case, I think the FS
was created by an earlier incarnation of the machine I’m on.
However it is marked Read Only, and there doesn’t seem to be any way to
change it. Properties window says it is Read only (with a square, not a
checkmark) and Hidden, and it lets me think I’m changing it, even asks if
I want to change all subordinates, but never changes it. That’s an OT,
but I’d be happy to hear a solution to it.
The Properties window doesn’t display whether a directory is or is not
readable as per the POSIX-y meaning of the concept. It should
display as read-only, if the contents of the directory are read-only,
contents aren’t actually checked, if only because it might end up taking
bloody long. I’m not even sure how those vestigial FAT attributes map to
ones. If you really want to get nitty-gritty with the system, check
setting it is that’s hiding the NTFS ACLs from you and look at those.
Slight sidenote: You really don’t want to touch System Volume
unless you really know what you’re doing.
The problem I’m having is that File.readable? and File.executable? both
give me true for that directory, but if I try Dir.chdir into it, it throws
Is there a check I can do, or is my only option: rescue Errno::EACCES?
And I guess the followup is: is it much more expensive in Ruby to catch
exceptions than to execute regular code (as it is in Java)?
Do you expect to run into inaccessible directories in the script more
than you actually process data in accessible ones? Unless so, I say
bother and use Errno::EACCES. The overhead isn’t likely to be
compared to total execution time.