From: Daniel Berger Date: 2005-12-31T20:03:29+09:00 Subject: Re: Path Separator and Windows Stefan Lang wrote: > On Thursday 29 December 2005 22:04, Justin Johnson wrote: > > Using ruby 1.8.2 on Windows XP, the path separator used for things > > like File.join is always / instead of \. Is there a way to force > > ruby to use the correct path separator? > > For ruby, "/" *is* the correct path separator. AFAIK, ruby > internally uses the slash as path separator on all platforms. > > I recommend to use slashes and convert them to backslashes > when external programs are called. Perhaps a library can > help you; searching for "win" on RAA: > > http://raa.ruby-lang.org/search.rhtml?search=win > > Kind regards, > Stefan Except that not all Windows functions accept '/' for a path separator. So, if you happen to be passing the result of File.join to, say, PathAppend using Win32API, it's going to fail. If you definitely need backslashes then either take Austin's suggestion and use gsub, or use the pathname2 package (on the RAA), which returns a path with the "correct" separator. :) Regards, Dan