[Ironruby-core] FW: File.executable? always returns false on Windows machine

Jim Deville jdeville at microsoft.com
Fri Apr 3 17:52:22 EDT 2009

We should probably return true if the extension is in PATHEXT. This should return true for EXE,COM, CMD, BAT, PS1 (if you have Powershell). It would be nice if we could inspect whatever assoc touches, so that if I add an assoc and filetype for RB, it becomes executable.


From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Michael Letterle
Sent: Friday, April 03, 2009 12:04 PM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] FW: File.executable? always returns false on Windows machine

On *nix systems it would return true if the executable bit is set and false if it's not.  Windows doesn't really have a comparable attribute since files are "categorized" based on extension, hence .exe acting as a sort of "executable bit".
On Fri, Apr 3, 2009 at 1:36 PM, Shri Borde <Shri.Borde at microsoft.com<mailto:Shri.Borde at microsoft.com>> wrote:

Anyone know what File.executable? is supposed to do? For me, it always returns false. For Jim, Tomas and others, it always returns true no matter what the file extension is. Any idea why we might be getting different results?

FWIW, the current IronRuby implementation returns true if the file extension is ".exe".



From: Shri Borde
Sent: Thursday, April 02, 2009 3:59 PM
To: ruby-core at ruby-lang.org<mailto:ruby-core at ruby-lang.org>
Subject: File.executable? always returns false on Windows machine

On my machine, File.executable? is always returning false. I have tried 1.8p27. I am running on a Windows Vista x86 machine. The file system is NTFS. I can't think of anything unusual about my machine.

What are the semantic supposed to be? Most of the people I have asked get a value of true for all of the statements below, even for the File.executable? on the ttf file.

puts File.exists?("C:/windows/fonts/wingding.ttf")

puts File.readable?("C:/windows/fonts/wingding.ttf")

puts File.executable?("C:/windows/fonts/wingding.ttf") # Prints false only for me

puts File.exists?("C:/windows/notepad.exe")

puts File.readable?("C:/windows/notepad.exe")

puts File.executable?("C:/windows/notepad.exe") # Prints false only for me

With the 1.9 binaries, File.executable? returns true only if the file extensions is something like .exe. Again, it always returns true for the people I have asked.



Ironruby-core mailing list
Ironruby-core at rubyforge.org<mailto:Ironruby-core at rubyforge.org>

Michael Letterle
IronRuby MVP

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090403/81f3d243/attachment.html>

More information about the Ironruby-core mailing list