Advertisement
LiTTleDRAgo

[RGSS] RPG_FileTest.exist?

Oct 8th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.50 KB | None | 0 0
  1. module RPG_FileTest
  2.  
  3.   def self.exist?(filename)
  4.     dir,ext = File.dirname(filename) + '/', File.extname(filename)
  5.     base = File.basename(filename, ext)
  6.     if ['.png','.jpg','.bmp'].include?(ext.downcase)
  7.       cache = defined?(Cache) ? Cache : RPG::Cache
  8.       (cache.load_bitmap(dir,base) && true) rescue false
  9.     elsif ['.rxdata','.rvdata','.rvdata2','.rb','.txt'].include?(ext.downcase)
  10.       (load_data(filename) && true) rescue false
  11.     else
  12.       File.exist?(filename)
  13.     end
  14.   end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement