Michael Malone
3/10/2009 8:06:00 PM
Juan Zanos wrote:
> Yes, I'm mostly concerned with paths. I'd like to write everything
> in Unix style and just have it automatically converted somehow so
> everything stays relatively legible.
>
>
One good pattern for dealing with this I have seen is simply to have a
shell_command method somewhere, so you can do different things if you're
on different OSs. And to figure out dynamically which OS you're working
with, use this:
require 'rbconfig'
if Config::CONFIG["target_os"] == 'linux'
OS = 'linux'
else
OS = 'windows' #presumably
end
Yes, I am aware that that code is specific to linux/windows but it was
enough for me. You're a puts call away from getting the required
options. That sort of thing can make life easier if you want to
redirect to /dev/null or NUL and only want to change your command in one
place.
Michael
=======================================================================
This email, including any attachments, is only for the intended
addressee. It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================