File.extname("foo bar") = " bar" .................?

T

ThoML

Hi,

I just realized that the result of

File.extname("foo bar")

is

=> " bar"

I have to admit this comes unexpected. In file.c, I found this

#if USE_NTFS
#define istrailinggabage(x) ((x) == '.' || (x) == ' ')
#else
#define istrailinggabage(x) 0
#endif

and

#if defined _WIN32 || defined __CYGWIN__
#define USE_NTFS 1
#else
#define USE_NTFS 0
#endif

Is this intentional? Could somebody please explain.

This is on
ruby 1.8.7 (2008-06-20 patchlevel 22) [i386-cygwin]
and
ruby 1.9.0 (2008-06-20 revision 17482) [i386-cygwin]

With ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] the result is
closer to what I'd expect:
$ /cygdrive/c/ruby/bin/ruby -e "p File.extname('foo bar')"
""

Thanks,
Thomas.
 
N

Nobuyoshi Nakada

Hi,

At Mon, 7 Jul 2008 00:26:39 +0900,
ThoML wrote in [ruby-talk:307404]:
I just realized that the result of

File.extname("foo bar")

is

=> " bar"

Thank you, fixed now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top