Module: RGSS3::RTP
- Defined in:
- lib/rgss3/rtp.rb
Class Attribute Summary collapse
-
.path ⇒ Object
The RTP path.
Class Method Summary collapse
-
.find(basename, extnames) ⇒ Object
find file in current directory and RTP directory.
-
.find!(basename, extnames) ⇒ Object
same as find, except that find! raise error when not found.
Class Attribute Details
.path ⇒ Object
The RTP path
6 7 8 |
# File 'lib/rgss3/rtp.rb', line 6 def path @path end |
Class Method Details
.find(basename, extnames) ⇒ Object
find file in current directory and RTP directory
10 11 12 13 14 15 16 17 18 19 20 21 |
# 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) ⇒ Object
same as find, except that find! raise error when not found
24 25 26 27 28 29 30 31 |
# 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 |