From: Luis Lavena Date: 2011-12-20T04:46:03+09:00 Subject: [ruby-core:41727] Re: Feature : optional argument in File.join On Mon, Dec 19, 2011 at 12:52 PM, Michel Demazure wrote: > > Apparently, this does not work with Gtk::FileSelection, which does not > recognize a path unless given the filename in the OS way. The doc says > something of this kind (but only about encodings). See > > http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3AFileSelection > > which says : > > filename=(filename) > � �Sets a default path for the file requestor. If filename includes a > directory path, then the requestor will open with that path as its > current working directory. The encoding of filename is the on-disk > encoding, which may not be UTF-8. See GLib.filename_from_utf8. > Oh, that is nasty. Even Windows API that people complain that sucks, it properly understand and handle mixture of / with \\ and manage to open the file :P > I think I will just use the ordinary File.join, then gsub('/', '\') > before giving the name to FileSelection. > path = File.join foo, bar path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR A bummer, perhaps you can submit a request to ruby-gnome2 so they can do the path normalization instead? -- Luis Lavena AREA 17 - Perfection in design is achieved not when there is nothing more to add, but rather when there is nothing more to take away. Antoine de Saint-Exup�ry