A
Alex DeCaria
After experimenting with Ruby 1.9 I've found I really like it and wanted
to make it my main version of Ruby. My problem was that I have two
programs that I use frequently that only work with Ruby 1.8. I want my
programs to run just by clicking the icons on my Windows desktop.
However, when setting the default application for an icon, Windows
forces you to choose between running all the .rb programs using either
1.9 or 1.8 (you can't set some to default to 1.9 and others to default
with 1.8 as far as I can tell).
I was trying to figure out how to get around this, and hit upon the
following:
- I set Ruby 1.9 as the default program for all my .rb icons on my
desktop.
- For thos few programs that need to run under Ruby 1.8 I wrote a simple
ruby script that calls the Kernel.system method:
system( "C:\Ruby\bin\rubyw.exe my_Ruby1.8_program.rb" )
I run this script in Ruby 1.9, but the system method executes the target
program using Ruby 1.8. I have the icon for this script on my desktop,
rather than the icon for the actual 1.8 program. Thus, it is
transparent to me whether, when I click on an icon, it runs in Ruby 1.8
or in Ruby 1.9.
It seems to work fine. However, if others have a more elegant or better
solution, or can see potential problems with this solution, I would be
interested in hearing about it.
Thanks.
--Alex
to make it my main version of Ruby. My problem was that I have two
programs that I use frequently that only work with Ruby 1.8. I want my
programs to run just by clicking the icons on my Windows desktop.
However, when setting the default application for an icon, Windows
forces you to choose between running all the .rb programs using either
1.9 or 1.8 (you can't set some to default to 1.9 and others to default
with 1.8 as far as I can tell).
I was trying to figure out how to get around this, and hit upon the
following:
- I set Ruby 1.9 as the default program for all my .rb icons on my
desktop.
- For thos few programs that need to run under Ruby 1.8 I wrote a simple
ruby script that calls the Kernel.system method:
system( "C:\Ruby\bin\rubyw.exe my_Ruby1.8_program.rb" )
I run this script in Ruby 1.9, but the system method executes the target
program using Ruby 1.8. I have the icon for this script on my desktop,
rather than the icon for the actual 1.8 program. Thus, it is
transparent to me whether, when I click on an icon, it runs in Ruby 1.8
or in Ruby 1.9.
It seems to work fine. However, if others have a more elegant or better
solution, or can see potential problems with this solution, I would be
interested in hearing about it.
Thanks.
--Alex