Is there any object-oriented File class in ruby?

No, the documentation is incorrect: it states that the only path
separator accepted by File.basename is "/" regardless of OS. But the
method clearly accepts "\" (properly escaped) on Windows systems.

Note that (on Windows XP) :

C:\>mkdir tmp

C:\>dir tmp
Le volume dans le lecteur C s'appelle Disque local
Le numéro de série du volume est 8C46-917E

Répertoire de C:\tmp

20/02/2008 16:35 <REP> .
20/02/2008 16:35 <REP> ..
               0 fichier(s) 0 octets
               2 Rép(s) 162.128.375.808 octets libres

C:\>mkdir "tmp/test"

C:\>dir tmp
Le volume dans le lecteur C s'appelle Disque local
Le numéro de série du volume est 8C46-917E

Répertoire de C:\tmp

20/02/2008 16:35 <REP> .
20/02/2008 16:35 <REP> ..
20/02/2008 16:35 <REP> test
               0 fichier(s) 0 octets
               3 Rép(s) 162.128.375.808 octets libres

And the / character is forbidden in file names.

Fred

···

Le 20 février à 16:06, Christopher Dicely a écrit :
--
Toute ressemblance avec un message écrit par un être au moins aussi
intelligent qu'un singe tapant sur une machine à écrire pour reproduire
du Shakespeare serait purement fortuite; prière de prévenir en cas de
miracle. (Jokeuse, sur #lacave)

That is because Ruby on Windows defines File::ALT_SEPARATOR and on
*nix doesn't:

irb(main):001:0> File::SEPARATOR
=> "/"
irb(main):002:0> File::ALT_SEPARATOR
=> "\\"
irb(main):003:0> RUBY_PLATFORM
=> "i386-mswin32"

irb(main):001:0> File::SEPARATOR
=> "/"
irb(main):002:0> File::ALT_SEPARATOR
=> nil
irb(main):003:0> RUBY_PLATFORM
=> "x86_64-linux"

HTH,

···

On Feb 20, 1:06 pm, Christopher Dicely <cmdic...@gmail.com> wrote:

No, the documentation is incorrect: it states that the only path
separator accepted by File.basename is "/" regardless of OS. But the
method clearly accepts "\" (properly escaped) on Windows systems.

--
Luis Lavena