lib/openstudio-standards/standards/standard.rb in openstudio-standards-0.2.0 vs lib/openstudio-standards/standards/standard.rb in openstudio-standards-0.2.1
- old
+ new
@@ -110,12 +110,12 @@
top_dir = File.expand_path('../../..', File.dirname(__FILE__))
standards_data_dir = "#{top_dir}/data/standards"
@standards_data = {}
standards_files.sort.each do |standards_file|
temp = ''
- begin
+ if __dir__[0] == ':' # Running from OpenStudio CLI
temp = load_resource_relative("../../../data/standards/#{standards_file}", 'r:UTF-8')
- rescue NoMethodError
+ else
File.open("#{standards_data_dir}/#{standards_file}", 'r:UTF-8') do |f|
temp = f.read
end
end
file_hash = JSON.parse(temp)