# Antwort: Re: SEPARATOR doesn't work

**URL:** <https://rubytalk.org/t/antwort-re-separator-doesnt-work/8473>\
**Category:** ruby-talk\
**Created:** [9 October 2003 11:29 UTC](https://rubytalk.org/t/antwort-re-separator-doesnt-work/8473 "2003-10-09T11:29:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Koepferl](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@Robert\_Koepferl](https://rubytalk.org/u/Robert_Koepferl)\
**Post date:** [9 October 2003 11:29 UTC](https://rubytalk.org/t/antwort-re-separator-doesnt-work/8473/1 "2003-10-09T11:29:11Z")

</div>

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?  
I intended to split a user given paht in its components. Thus needing it  
(or not?).

```
                  Gennady                                                                                                                       
                  <gfb@tonesoft.co An: ruby-talk@ruby-lang.org (ruby-talk ML)                                                      
                  > Kopie:                                                                                               
                                           Thema: Re: SEPARATOR doesn't work                                                                  
                  08.10.2003 18:04                                                                                                              
                  Bitte antworten                                                                                                               
                  an ruby-talk

```

> **···**
>
> [Robert.Koepferl@de.gi-de.com](mailto:Robert.Koepferl@de.gi-de.com) wrote:
> 
> > Hi,  
> > I’m using ruby-win32 1.6 and I’m trying to get the Path-separator ( eg. /  
> > or \ ) to wirte protable programs
> > 
> > However
> > 
> > File.SEPARATOR  
> > SEPARATOR  
> > $SEPARATOR  
> > Dir.SEPARATOR
> > 
> > all return nil. What’s wrong
> 
> irb(main):001:0\> File.SEPARATOR  
> NameError: undefined method `SEPARATOR’ for File:Class  
> from (irb):1  
> irb(main):002:0\> File::SEPARATOR  
> =\> “/”

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)\
**Post date:** [9 October 2003 13:52 UTC](https://rubytalk.org/t/antwort-re-separator-doesnt-work/8473/2 "2003-10-09T13:52:59Z")

</div>

[Robert.Koepferl@de.gi-de.com](mailto:Robert.Koepferl@de.gi-de.com) schrieb im Newsbeitrag  
[news:OFD475C346.5D134A27-ONC1256DBA.003E7FD3@gdm.de](mailto: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

```

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [13 October 2003 22:35 UTC](https://rubytalk.org/t/antwort-re-separator-doesnt-work/8473/3 "2003-10-13T22:35:18Z")

</div>

> 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?

File::ALT\_SEPARATOR is non-nil on win32. Actually, you can use / or   
as the file separator on win32. Try cd /some/win32/path.

> **···**
>
> [Robert.Koepferl@de.gi-de.com](mailto:Robert.Koepferl@de.gi-de.com) ([Robert.Koepferl@de.gi-de.com](mailto:Robert.Koepferl@de.gi-de.com)) wrote:
> 
> > I intended to split a user given paht in its components. Thus needing it  
> > (or not?).
> 
> –  
> Eric Hodel - [drbrain@segment7.net](mailto:drbrain@segment7.net) - [http://segment7.net](http://segment7.net)  
> All messages signed with fingerprint:  
> FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

---

<div class="post-metadata">

**Author:** ![Pierre\_Baillet](https://avatars.discourse-cdn.com/v4/letter/p/958977/32.png) [@Pierre\_Baillet](https://rubytalk.org/u/Pierre_Baillet)\
**Post date:** [9 October 2003 14:07 UTC](https://rubytalk.org/t/antwort-re-separator-doesnt-work/8473/4 "2003-10-09T14:07:12Z")

</div>

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](mailto:Robert.Koepferl@de.gi-de.com) schrieb im Newsbeitrag  
> > [news:OFD475C346.5D134A27-ONC1256DBA.003E7FD3@gdm.de](mailto: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
