Greetings all. I have some controller code that uses win32ole (only available on windows). This code is now solid, and I'd now like to resume development on (any) other OS(grin). But alas, the controller bails because the OS specific library can't be found. Can I conditionally specify action code compilation (and a require 'win32ole') based on OS or maybe an environment variable? (I'm thinking C #IFDEFs) Or perhaps an empty stub win32ole library for OSX/Linux? Thanks for your thoughts. Cheers, Jodi
on 2006-05-04 18:05
on 2006-05-05 01:01
You can wrap in if statement around any require. Try this: if RUBY_PLATFORM =~ /mswin32/ # Matches win32 string in RUBY_PLATFORM constant require 'win32ole' end Of course, you'll need similar code around any place where you actually use the Windows specific stuff.