Skip to content

Commit 4380ab1

Browse files
authored
cmdsim.rb: fix ruby syntax (#1884)
This replaces File.exists? calls with File.exist? to fix the UNIT_gz_TEST on macOS. It also removes a rescue statement that was hiding useful error messages. Signed-off-by: Steve Peters <[email protected]>
1 parent a274c8a commit 4380ab1

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/cmd/cmdsim.rb.in

+3-7
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ has properly set the DYLD_LIBRARY_PATH environment variables."
413413
parsed = ''
414414
if options['file'] != ''
415415
# Check if the passed in file exists.
416-
if File.exists?(options['file'])
416+
if File.exist?(options['file'])
417417
path = options['file']
418418
# If not, then first check the GZ_SIM_RESOURCE_PATH environment
419419
# variable, then the configuration path from the launch library.
@@ -434,7 +434,7 @@ Please use [GZ_SIM_RESOURCE_PATH] instead."
434434
resourcePaths = resourcePathEnv.split(':')
435435
for resourcePath in resourcePaths
436436
filePath = File.join(resourcePath, options['file'])
437-
if File.exists?(filePath)
437+
if File.exist?(filePath)
438438
path = filePath
439439
break
440440
end
@@ -444,7 +444,7 @@ Please use [GZ_SIM_RESOURCE_PATH] instead."
444444
if path.nil?
445445
Importer.extern 'char *worldInstallDir()'
446446
path = File.join(Importer.worldInstallDir().to_s, options['file'])
447-
if !File.exists?(path)
447+
if !File.exist?(path)
448448
path = Importer.findFuelResource(options['file']).to_s
449449
options['file'] = path
450450
if path == ""
@@ -556,10 +556,6 @@ See https://github.com/gazebosim/gz-sim/issues/168 for more info."
556556
Importer.runGui(options['gui_config'], options['file'],
557557
options['wait_gui'], options['render_engine_gui'])
558558
end
559-
rescue
560-
puts "Library error: Problem running [#{options['command']}]() "\
561-
"from #{plugin}."
562-
# begin
563559
end
564560
# execute
565561
end

0 commit comments

Comments
 (0)