From: Robert Klemme Date: 2010-02-11T17:06:11+09:00 Subject: Re: ruby cross-platform File.basename 2010/2/10 bwv549 : >> What's wrong with using File.basename? > > On linux, you cannot get the basename of windows-ish files: > > # on linux: > File.basename("C:\\path\\to\\file.txt")  # -> gives: "C:\\path\\to\ > \file.txt" > > Heaven knows I would like to avoid all windows path names, but just > after you write something worthwhile you are told it needs to be able > to run on windows, too. Well, File.basename will work properly on a Windows system. Do you need to process windows path names on a *nix system? If not, then you should be fine just using File.basename. There is a reason why the standard library provides this method... >  The point is that it would be nice to know > how to *always* get the basename on any system for any kind of > filename. That might be difficult without context information. IMHO that information about the platform is encoded in File.basename's implementation on your platform of choice. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/