Skip to content

Commit

Permalink
File.exists? -> File.exist?
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed May 14, 2024
1 parent 4c89c58 commit e6ac94b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion developer/GitHubIssueStats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
repo = 'openstudio-sketchup-plugin'

github = Github.new
if File.exists?(Dir.home + '/github_config.yml')
if File.exist?(Dir.home + '/github_config.yml')
github_options = YAML.load_file(Dir.home + '/github_config.yml')
token = github_options['oauth_token']
github = Github.new oauth_token: token
Expand Down
10 changes: 5 additions & 5 deletions plugin/openstudio/lib/SimulationManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ def run_simulation
return(false)
end

if (not File.exists?(Plugin.energyplus_path))
if (not File.exist?(Plugin.energyplus_path))
UI.messagebox("Cannot locate the EnergyPlus engine. Correct the EXE path and try again.")
Plugin.dialog_manager.show(PreferencesInterface)
return(false)
end

idd_path = Plugin.energyplus_dir + "/Energy+.idd"
if (not File.exists?(idd_path))
if (not File.exist?(idd_path))
UI.messagebox("Cannot locate the input data dictionary (IDD) in the EnergyPlus directory. Correct the EXE path and try again.")
Plugin.dialog_manager.show(PreferencesInterface)
return(false)
Expand All @@ -106,7 +106,7 @@ def run_simulation
else
expandobjects_path = Plugin.energyplus_dir + '/expandobjects'
end
if (not File.exists?(expandobjects_path))
if (not File.exist?(expandobjects_path))
UI.messagebox("Cannot locate ExpandObjects in the EnergyPlus directory. Correct the EXE path and try again.")
Plugin.dialog_manager.show(PreferencesInterface)
return(false)
Expand All @@ -115,13 +115,13 @@ def run_simulation
readvars_path = ""
if (Plugin.platform == Platform_Windows)
readvars_path = Plugin.energyplus_dir + '/PostProcess/ReadVarsESO.exe'
if (not File.exists?(readvars_path))
if (not File.exist?(readvars_path))
readvars_path = Plugin.energyplus_dir + '/readvars.exe'
end
else
readvars_path = Plugin.energyplus_dir + '/readvars'
end
if (not File.exists?(readvars_path))
if (not File.exist?(readvars_path))
UI.messagebox("Cannot locate ReadVarsESO in the EnergyPlus directory. Correct the EXE path and try again.")
Plugin.dialog_manager.show(PreferencesInterface)
return(false)
Expand Down
4 changes: 2 additions & 2 deletions plugin/openstudio/lib/dialogs/PreferencesInterface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def report

if (openstudio_dir.nil? or openstudio_dir.empty?)
# do nothing, assume user wants to clear
elsif (not File.exists?(openstudio_dir))
elsif (not File.exist?(openstudio_dir))
UI.messagebox("WARNING: #{openstudio_dir} does not exist.")
elsif (not File.exists?(key_file))
elsif (not File.exist?(key_file))
UI.messagebox("WARNING: #{key_file} does not exist.")
end

Expand Down
2 changes: 1 addition & 1 deletion plugin/openstudio/lib/interfaces/ResultsInterface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def attach_output_file(output_file_path)
openstudio_model = @model_interface.openstudio_model
old_sql_file = openstudio_model.sqlFile

if File.exists?(output_file_path)
if File.exist?(output_file_path)
begin
new_sql_file = OpenStudio::SqlFile.new(OpenStudio::Path.new(output_file_path))
openstudio_model.setSqlFile(new_sql_file)
Expand Down
4 changes: 2 additions & 2 deletions plugin/openstudio/startup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

while true

if openstudio_dir.nil? || !File.exists?(openstudio_dir)
if openstudio_dir.nil? || !File.exist?(openstudio_dir)

prompts = ["Path to OpenStudio Root Directory"]
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
Expand Down Expand Up @@ -76,7 +76,7 @@
key_file = File.join(openstudio_dir, "Ruby/openstudio.rb")
end

if File.exists?(key_file)
if File.exist?(key_file)
Sketchup.write_default("OpenStudio", "OpenStudioDir", openstudio_dir)
break
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def get_sch_from_lib(sch_name, model)
#puts "component_dir = #{component_dir}"
puts "creating directories"
FileUtils.rm_rf(component_dir) if File.exists?(component_dir) and File.directory?(component_dir)
FileUtils.rm_rf(component_dir) if File.exist?(component_dir) and File.directory?(component_dir)
FileUtils.mkdir_p(component_dir)
FileUtils.mkdir_p("#{component_dir}/files/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def run(model, runner, user_arguments)

if savediagnostic
newfilename = open_path.gsub(".osm","_diagnostic.osm")
if File.exists? newfilename
if File.exist? newfilename
# I would like to add a prompt to ask the user if they want to overwrite their file
end
puts ""
Expand Down

0 comments on commit e6ac94b

Please sign in to comment.