[#23231] What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Dear Ruby developers and users!

8 messages 2009/04/17

[#23318] [Feature #1408] 0.1.to_r not equal to (1/10) — Heesob Park <redmine@...>

Feature #1408: 0.1.to_r not equal to (1/10)

19 messages 2009/04/26

[ruby-core:23165] FW: Case of drive letter

From: Shri Borde <Shri.Borde@...>
Date: 2009-04-08 17:41:10 UTC
List: ruby-core #23165
I have opened http://redmine.ruby-lang.org/issues/show/1366 to track this issue.

Thanks,
Shri

From: ironruby-core-bounces@rubyforge.org [mailto:ironruby-core-bounces@rubyforge.org] On Behalf Of Shri Borde
Sent: Tuesday, April 07, 2009 11:36 AM
To: ironruby-core@rubyforge.org
Subject: [Ironruby-core] Case of drive letter

Using MRI on Windows, Dir.pwd can use either lower-case or upper-case for the drive letter ("C:/" or "c:/") depending on the Command Prompt it is run from. However, __FILE__ always uses lower-case drive letter. This can cause problems when comparing Dir.pwd and __FILE__. For eg, Pathname#relative_path_from<http://ruby-doc.org/core/classes/Pathname.html#M001745> raises an ArgumentError if the arguments use different cases for the drive letter.

C:\Users\sborde> cat c:\bugs\rb1.rb
require 'pathname'
Pathname.new(Dir.pwd).relative_path_from(Pathname.new(__FILE__))

C:\Users\sborde> c:\Ruby\bin\ruby.exe c:\bugs\rb1.rb
c:/Ruby/lib/ruby/1.8/pathname.rb:709:in `relative_path_from': different prefix:
"C:/" and "c:/bugs/rb1.rb" (ArgumentError)
        from c:/bugs/rb1.rb:2

I did not find any good documentation on which case is used by Command Prompt, but https://lists.ubuntu.com/archives/bazaar/2006q2/013921.html refers to the issue. I can create Command Prompts with either case by creating a shortcut on the desktop, and specifying a "Start in" folder property for the shortcut. Command Prompt will use the case specified for the "Start in" folder.

Does anyone have experience dealing with this issue? What is the recommended solution? I would rather not check the case of the drive letter manually. I looked for APIs which would convert the drive letter to lower-case, but could not find anything.

Thanks,
Shri

Attachments (1)

ATT00001.txt (159 Bytes, text/plain)
_______________________________________________
Ironruby-core mailing list
Ironruby-core@rubyforge.org
http://rubyforge.org/mailman/listinfo/ironruby-core

In This Thread

Prev Next