openstudiocore/src/cli/embedded_help.rb
# ":" is our root path to the embedded file system
# make sure it is in the ruby load path
":" is our root path to the embedded file system
make sure it is in the ruby load path
" : " is our root path to the embedded file system make sure it is in the ruby load path
def require path
    rb_path = path
    if path.include? 'openstudio/energyplus/find_energyplus'
      return false
    end
    if path.include? 'json/ext'
      if RUBY_PLATFORM =~ /mswin/
        raise LoadError.new("Preventing segfault if native JSON is built as MinGW")
      end
    end
    extname = File.extname(path)
    if extname.empty? or extname != '.rb'
      rb_path = path + '.rb'
    end
    if rb_path.to_s.chars.first == ':'
       if $LOADED.include?(rb_path) then
         return true
      else
        return require_embedded_absolute(rb_path)
      end
    elsif rb_path == 'openstudio.rb'
      return true
    else
      $LOAD_PATH.each do |p|
        if p.to_s.chars.first == ':' then
          embedded_path = p + '/' + rb_path
          if $LOADED.include?(embedded_path) then
            return true
          elsif EmbeddedScripting::hasFile(embedded_path) then
            return require_embedded_absolute(embedded_path)
          end
        end
      end
    end
    return original_require path
  end
def require path rb_path = path if path . include? 'openstudio/energyplus/find_energyplus' return false end if path . include? 'json/ext' if RUBY_PLATFORM =~ / mswin / raise LoadError . new ( "Preventing segfault if native JSON is built as MinGW" ) end end extname = File . extname ( path ) if extname . empty? or extname != '.rb' rb_path = path + '.rb' end if rb_path . to_s . chars . first == ':' if $LOADED . include? ( rb_path ) then return true else return require_embedded_absolute ( rb_path ) end elsif rb_path == 'openstudio.rb' return true else $LOAD_PATH . each do | p | if p . to_s . chars . first == ':' then embedded_path = p + '/' + rb_path if $LOADED . include? ( embedded_path ) then return true elsif EmbeddedScripting :: hasFile ( embedded_path ) then return require_embedded_absolute ( embedded_path ) end end end end return original_require path end
":" is our root path to the embedded file system
make sure it is in the ruby load path
" : " is our root path to the embedded file system make sure it is in the ruby load path
path
<not_specific>