module RGSS3::RTP

Attributes

path[RW]

The RTP path

Public Class Methods

find(basename, extnames) click to toggle source

find file in current directory and RTP directory

# File lib/rgss3/rtp.rb, line 10
def self.find(basename, extnames)
  basename = basename.to_str
  extnames.each do |ext|
    filename = basename + ext
    if File.exist?(filename)
      return filename
    elsif @path && File.exist?(filename = File.absolute_path(filename, @path))
      return filename
    end
  end
  nil
end
find!(basename, extnames) click to toggle source

same as find, except that find! raise error when not found

# File lib/rgss3/rtp.rb, line 24
def self.find!(basename, extnames)
  result = find(basename, extnames)
  if result
    result
  else
    raise "File not found: #{basename}"
  end
end