Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > require upper/lower case filenames on a Windows box...

Reply
Thread Tools

require upper/lower case filenames on a Windows box...

 
 
Stephan Kämper
Guest
Posts: n/a
 
      02-01-2005
Hi,

I'm running the latest one-click-installer (1.8.2-14) on a WinXP box.

With

require 'Date'

you'll likely get an error, but with

require 'date'

you won't...

[irb session begin] ------------------------------------
E:\>irb
irb(main):001:0> require 'Date'
c:/ruby/lib/ruby/1.8/Date.rb:238: warning: already initialized constant
MONTHNAMES
c:/ruby/lib/ruby/1.8/Date.rb:243: warning: already initialized constant
DAYNAMES
c:/ruby/lib/ruby/1.8/Date.rb:247: warning: already initialized constant
ABBR_MONTHNAMES
c:/ruby/lib/ruby/1.8/Date.rb:250: warning: already initialized constant
ABBR_DAYNAMES
c:/ruby/lib/ruby/1.8/Date.rb:254: warning: already initialized constant
ITALY
c:/ruby/lib/ruby/1.8/Date.rb:258: warning: already initialized constant
ENGLAND
c:/ruby/lib/ruby/1.8/Date.rb:262: warning: already initialized constant
JULIAN
c:/ruby/lib/ruby/1.8/Date.rb:266: warning: already initialized constant
GREGORIAN
NameError: undefined method `today' for `DateTime'
from c:/ruby/lib/ruby/1.8/Date.rb:1261:in `undef_method'
from c:/ruby/lib/ruby/1.8/Date.rb:1261
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require__'
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/loadpath_manager.rb:5:in `require'
from (irb):1
[irb session end] ------------------------------------




This doesn't seem to be an irb issue since running "require 'date'"
outside irb yields the same result:

E:\>ruby -v
ruby 1.8.2 (2004-12-25) [i386-mswin32]

E:\>ruby -r Date -e ''
c:/ruby/lib/ruby/1.8/date.rb:238: warning: already initialized constant
MONTHNAMES
---------------- [snipped part of the output] ----------------



BTW, on the identical hardware running Linux I get...

[stk@tao ~]$ ruby -v
ruby 1.8.2 (2004-12-25) [i686-linux]
[stk@tao ~]$ ruby -r date -e ''
[stk@tao ~]$

... no error, while 'Date' raises a file not found Error.


Aha, I think this happens: On Linux everything works fine.

On Windows however, the case dependency with respect to filenames
is sub-optimal. Requiring the file with the 'correct' file name
'date' yields the expected behaviour ('require' returns false).

But requiring a slightly misspelled filename as 'Date' leads to
the following:

1. 'Date' is not found in the list of already loaded files.
2. Loading the file doesn't yield an Error - because Windows
finds 'date'.
3. Bad things happen on a Windows box, while processing that file.



Happy rubying

Stephan
 
Reply With Quote
 
 
 
 
Daniel Berger
Guest
Posts: n/a
 
      02-01-2005

Stephan Kämper wrote:
> Hi,
>
> I'm running the latest one-click-installer (1.8.2-14) on a WinXP box.
>
> With
>
> require 'Date'
>
> you'll likely get an error, but with
>
> require 'date'


"Date" != "date", even on Win32. Plus, NTFS supports case sensitive
file names.
The error is not exactly what I would expect, though.

Dan

 
Reply With Quote
 
 
 
 
Austin Ziegler
Guest
Posts: n/a
 
      02-01-2005
On Wed, 2 Feb 2005 01:25:44 +0900, Daniel Berger
<(E-Mail Removed)> wrote:
> Stephan Kämper wrote:
>> I'm running the latest one-click-installer (1.8.2-14) on a WinXP
>> box.
>>
>> With
>> require 'Date'
>> you'll likely get an error, but with
>> require 'date'

> "Date" != "date", even on Win32. Plus, NTFS supports case
> sensitive file names. The error is not exactly what I would
> expect, though.


Mmmm. Case preserving, not case sensitive. One of the things that MS
and Apple got right and Unix got wrong.

-austin
--
Austin Ziegler * http://www.velocityreviews.com/forums/(E-Mail Removed)
* Alternate: (E-Mail Removed)



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
require fails when requiring scripts with utf-8 filenames. Daniel Jonson Ruby 4 06-13-2010 09:50 PM
case sensitive filenames Roedy Green Java 62 01-17-2009 03:12 AM
ASP.NET 2.0 web project changes filenames to lower case n33470 ASP .Net 0 12-07-2005 08:00 PM
Case Sensitivity in Windows 2000 Filenames? orljustin@aol.com C++ 9 06-26-2005 05:34 AM
problem with filenames, Filenames and FILENAMES B.J. HTML 4 04-23-2005 08:13 PM



Advertisments