diff --git a/openstudiocore/ruby/openstudio.rb b/openstudiocore/ruby/openstudio.rb index fce37ebac21..05fde61cc18 100644 --- a/openstudiocore/ruby/openstudio.rb +++ b/openstudiocore/ruby/openstudio.rb @@ -37,8 +37,22 @@ # add OpenStudio shared library locations to system path # we need to add these so that require can load the c++ shared libraries original_path = ENV['PATH'] +platform_specific_path = nil if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM) - ENV['PATH'] = "#{$OpenStudio_Dir};#{$OpenStudio_Dir}openstudio;#{original_path}" + front = [] + back = [] + original_path.split(';').each do |p| + if /SketchUp/.match(p) + if /platform_specific/.match(p) + platform_specific_path = p + end + front << p + else + back << p + end + end + + ENV['PATH'] = "#{front.join(';')};#{$OpenStudio_Dir};#{$OpenStudio_Dir}openstudio;#{back.join(';')}" # Pre-load our specific Qt Dll's on Windows to make sure we control which get loaded require 'Win32API' @@ -120,13 +134,18 @@ # restore original path ENV['PATH'] = original_path -if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_Dir}OpenStudio"))) - if (!OpenStudio::RemoteBCL::initializeSSL()) - raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries" +have_open_ssl = false +if platform_specific_path + have_open_ssl = OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new(platform_specific_path)) +end +if (!have_open_ssl) + if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_Dir}OpenStudio"))) + if (!OpenStudio::RemoteBCL::initializeSSL()) + raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries" + end end end - if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM) $OpenStudio_BinaryDir = "#{$OpenStudio_Dir}../bin/" elsif /darwin/.match(RUBY_PLATFORM) diff --git a/openstudiocore/ruby/openstudio_dev.rb b/openstudiocore/ruby/openstudio_dev.rb index 98960e16e7f..a4f304f2cee 100644 --- a/openstudiocore/ruby/openstudio_dev.rb +++ b/openstudiocore/ruby/openstudio_dev.rb @@ -34,8 +34,22 @@ # add binary dir to system path original_path = ENV['PATH'] +platform_specific_path = nil if /mswin/.match(RUBY_PLATFORM) or /mingw/.match(RUBY_PLATFORM) - ENV['PATH'] = "#{$OpenStudio_BinaryDir};#{$OpenStudio_RubyBinaryDir};#{original_path}" + front = [] + back = [] + original_path.split(';').each do |p| + if /SketchUp/.match(p) + if /platform_specific/.match(p) + platform_specific_path = p + end + front << p + else + back << p + end + end + + ENV['PATH'] = "#{front.join(';')};#{$OpenStudio_BinaryDir};#{$OpenStudio_RubyBinaryDir};#{back.join(';')}" else ENV['PATH'] = "#{$OpenStudio_BinaryDir}:#{$OpenStudio_RubyBinaryDir}:#{original_path}" end @@ -106,13 +120,18 @@ # restore original path ENV['PATH'] = original_path -if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_RubyBinaryDir}"))) - if (!OpenStudio::RemoteBCL::initializeSSL()) - raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries" +have_open_ssl = false +if platform_specific_path + have_open_ssl = OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new(platform_specific_path)) +end +if (!have_open_ssl) + if (!OpenStudio::RemoteBCL::initializeSSL(OpenStudio::Path.new("#{$OpenStudio_RubyBinaryDir}"))) + if (!OpenStudio::RemoteBCL::initializeSSL()) + raise "Unable to initialize OpenSSL: Verify that ruby can access the OpenSSL libraries" + end end end - # Find current ruby path, we may need this for launching ruby jobs later begin