src/cli/embedded_help.rb
# this function either reads a file from the embedded archive or from disk, returns file content as a string
this function either reads a file from the embedded archive or from disk, returns file content as a string
this function either reads a file from the embedded archive or from disk returns file content as a string
def load_resource_relative(path, mode='r')
    absolute_path = File.dirname(caller_locations(1,1)[0].path) + '/' + path
    if absolute_path.to_s.chars.first == ':'
      absolute_path = OpenStudio.get_absolute_path(absolute_path)
    end
    if EmbeddedScripting::hasFile(absolute_path)
      return EmbeddedScripting::getFileAsString(absolute_path)
    end
    result = ""
    if File.exists?(absolute_path)
      File.open(absolute_path, mode) do |file|
        result = file.read
      end
    elsif File.exists?(path)
      File.open(path, mode) do |file|
        result = file.read
      end
    end
    return result
  end
def load_resource_relative ( path , mode = 'r' ) absolute_path = File . dirname ( caller_locations ( 1 , 1 ) [ 0 ] . path ) + '/' + path if absolute_path . to_s . chars . first == ':' absolute_path = OpenStudio . get_absolute_path ( absolute_path ) end if EmbeddedScripting :: hasFile ( absolute_path ) return EmbeddedScripting :: getFileAsString ( absolute_path ) end result = "" if File . exists? ( absolute_path ) File . open ( absolute_path , mode ) do | file | result = file . read end elsif File . exists? ( path ) File . open ( path , mode ) do | file | result = file . read end end return result end
this function either reads a file from the embedded archive or from disk, returns file content as a string
this function either reads a file from the embedded archive or from disk returns file content as a string
path
<not_specific>
mode
<not_specific>