[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Aw: Re: Antwort: Re: SEPARATOR doesn't work

Robert.Koepferl

10/9/2003 2:32:00 PM





Ah I see.
However my paths come from the user. But the user doesn't concern about
ruby's conventions. There must be a way to work with (analyze, shorten
etc.) paths without the requirement for them to actually exist. I don't
work on real files...
What about that?
sep = if ENV['OS'] then "\\" else "/" end

thanks again



Pierre Baillet
<oct@zoy.org> An: ruby-talk@ruby-lang.org (ruby-talk ML)
Kopie:
09.10.2003 16:07 Thema: Re: Antwort: Re: SEPARATOR doesn't work
Bitte antworten
an ruby-talk







Hi,

in ruby, File::SEPARATOR is always "/" (at least on win32, cygwin and
linux build) and path are always composed of "/" and not "\" (even on
the win32 build, paths seems to be "translated" by ruby on the fly)...


Cheers,
Pierre.

On Thu, Oct 09, 2003, Robert Klemme wrote:
>
> <Robert.Koepferl@de.gi-de.com> schrieb im Newsbeitrag
> news:OFD475C346.5D134A27-ONC1256DBA.003E7FD3@gdm.de...
> >
> >
> >
> >
> > Thanks....just learned another thing.
> > It works fine, however there seems to be a bug or anything like this.
At
> > least in my (v1.6) version of Ruby File::SEPARATOR returns / on both,
> BSD
> > and Win32. Is this normal?
>
> If it is a cygwin built it's not an error since cygwin uses unix file
name
> conventions. If it's not cygwin, it's likely to be a bug. But I can't
> really remember whether was a bug, because 1.6 is way old... You should
> get yourself a new version.
>
> > I intended to split a user given paht in its components. Thus needing
it
> > (or not?).
>
> You should use:
>
> dir, name = File.split( path )
>
> Cheers
>
> robert
>

--
Pierre Baillet
Emacs, not just a way of life but a complete waste of disk space
Alan Cox





1 Answer

ahoward

10/9/2003 4:02:00 PM

0