Now this might just be my system and I certainly don’t have this problem with any of my FreeBSD machines, but I’ve got a weird problem with filenames and colons on my Mac (10.5.8) with Ruby (ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]).
Anyhow if I write something like this:
File.open('foo:bar.txt', 'w') {|f| f.write("hello world") }
Rather than get a file in the current directory named foo:bar.txt I actually get one named foo/bar.txt. I’ve tried various potential escape sequences (: \c etc.).
The colon name totally works as you’d imagine on my FreeBSD machines, so it must be something either to do with the Ruby version or OSX - I guess it must be half identifying the colon as a path separator, but the file created with the ’/’ in it is a proper file with that name.
Chalk one up to not enough time to debug, but enough time to note.
Written on 11 Jul 2010 and categorised in Macintosh and Ruby, tagged as colon and OSX