Skip to content

Commit f672308

Browse files
committed
Ruby - remove calls to deprecated File.exists?
Ruby renamed this to File.exist? which doesn't feel as readable, but in 3.2 File.exists has been removed completely :-(
1 parent e56d085 commit f672308

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/server/ruby/bin/spider-server.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464

6565

6666
begin
67-
if File.exists?(SonicPi::Paths.original_init_path)
68-
if (File.exists?(SonicPi::Paths.init_path))
67+
if File.exist?(SonicPi::Paths.original_init_path)
68+
if (File.exist?(SonicPi::Paths.init_path))
6969
STDOUT.puts "Warning, you have an older init.rb file in #{SonicPi::Paths.original_init_path} which is now being ignored as your newer config/init.rb file is being used instead. Consider deleting your old init.rb (perhaps copying anything useful across first)."
7070
else
7171
STDOUT.puts "Found init.rb in old location #{SonicPi::Paths.original_init_path}. Moving it to the new config directory #{SonicPi::Paths.init_path}."
@@ -245,7 +245,7 @@
245245
STDOUT.puts "Spider - Runtime Server Initialised"
246246
STDOUT.flush
247247
# read in init.rb if exists
248-
if File.exists?(SonicPi::Paths.init_path)
248+
if File.exist?(SonicPi::Paths.init_path)
249249
sp.__spider_eval(File.read(SonicPi::Paths.init_path), silent: true)
250250
else
251251
STDOUT.puts "Spider - Could not find init.rb file: #{SonicPi::Paths.init_path} "

app/server/ruby/util.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def jackd_pidfile()
3636
end
3737

3838
def jackd_pid()
39-
if File.exists?(scsynth_pidfile)
39+
if File.exist?(scsynth_pidfile)
4040
pid = File.readlines(jackd_pidfile).first.to_i
4141
pid == 0 ? nil : pid
4242
end
4343
end
4444

4545
def scsynth_pid()
46-
if File.exists?(scsynth_pidfile)
46+
if File.exist?(scsynth_pidfile)
4747
pid = File.readlines(scsynth_pidfile).first.to_i
4848
pid == 0 ? nil : pid
4949
end

0 commit comments

Comments
 (0)