SHARE
TWEET

[RGSS] RPG_FileTest.exist?

LiTTleDRAgo Oct 8th, 2016 (edited) 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top