# Re: File::Separator on win32

**URL:** <https://www.ruby-forum.com/t/re-file-separator-on-win32/99645>\
**Category:** Ruby\
**Created:** [July 24, 2006, 6:32pm UTC](https://www.ruby-forum.com/t/re-file-separator-on-win32/99645 "2006-07-24T18:32:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [July 24, 2006, 6:32pm UTC](https://www.ruby-forum.com/t/re-file-separator-on-win32/99645/1 "2006-07-24T18:32:58Z")

</div>

> . this confuses the system so that it cant find the files i  
> need. is there a way round? is this a bug or wanted behaviour?

Use File::ALT\_SEPARATOR instead.

Regards,

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [August 3, 2006, 2:24pm UTC](https://www.ruby-forum.com/t/re-file-separator-on-win32/99645/2 "2006-08-03T14:24:34Z")

</div>

is ALT\_SEPARATOR / on \*nixes? according to the docs, its , too. i need  
a  
portable way without the need to rewrite everything…

2006/7/24, Berger, Daniel [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > on my win32 machine, File::Separator returns / instead of a  
> > This communication is the property of Qwest and may contain confidential  
> > or  
> > privileged information. Unauthorized use of this communication is strictly  
> > prohibited and may be unlawful. If you have received this communication  
> > in error, please immediately notify the sender by reply e-mail and destroy  
> > all copies of the communication and any attachments.

–  
Michael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[www.stellar-legends.de](http://www.stellar-legends.de) - Weltraum-Browsergame im Alpha-Stadium

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [August 3, 2006, 2:24pm UTC](https://www.ruby-forum.com/t/re-file-separator-on-win32/99645/3 "2006-08-03T14:24:34Z")

</div>

Michael S. wrote:

> is ALT\_SEPARATOR / on \*nixes? according to the docs, its , too. i need a  
> portable way without the need to rewrite everything…

Which docs? Anyway, it’s nil on \*nix platforms. I’m not sure about  
VMS, though.

There’s always RUBY\_PLATFORM.match(‘mswin’) 🙂

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 23, 2008, 7:51pm UTC](https://www.ruby-forum.com/t/re-file-separator-on-win32/99645/4 "2008-05-23T19:51:48Z")

</div>

Daniel B. wrote:

> Michael S. wrote:
> 
> > is ALT\_SEPARATOR / on \*nixes? according to the docs, its , too. i need a  
> > portable way without the need to rewrite everything…
> 
> Which docs? Anyway, it’s nil on \*nix platforms. I’m not sure about  
> VMS, though.
> 
> There’s always RUBY\_PLATFORM.match(‘mswin’) 🙂
> 
> Regards,
> 
> Dan

`md #{File.join("c:","foo")}` fails as well. STDERR contains ‘The  
syntax of the command is incorrect’.

In other languages, like Java, the path separator constant/method is  
used to abstract the knowledge of which operating system is in play.  
Can it not be so in Ruby?
