Skip to main content

Posts

Showing posts from December, 2020

Ruby IO - file pathnames for use on different operating systems

I had finished writing a piece of software in Ruby in for Linux and wanted to test it also on PC. Since the software involved reading in some data from files, I wanted to be sure that the pathnames could be handled on PC. In Lisp, this is handled with relative ease where it's possible to specify the subdirectory of interest, and the file(s) within that, and it's up to the Lisp implementation to handle the differences between different operating systems.  I was rather expecting something similar for Ruby (given its influence from Lisp), but to my surprise, the official documentation on the File class had no information that I could find as to how pathnames would be handled differently on different operating systems.  Then I looked at the docs for the Ruby IO class , and found the information there. It says: Ruby will convert pathnames between different operating system conventions if possible. For instance, on a Windows system the filename "/gumby/ruby/test.rb" will

About Me

My photo
Vera
I'm a wife and mother. I don't have any formal computer science qualifications, or any religious qualifications. I have a PhD in biochemistry. This photo is of me, but is confusing for AI.