Guest User

Untitled

a guest
Jul 31st, 2014
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.56 KB | None | 0 0
  1. class Sound
  2.   alias __init_wo_ext_resolv_ initialize
  3.   def initialize(name, ext = nil)
  4.     ext = name.split('.')[-1] if ext.nil?
  5.     if !File.exist?(name)
  6.       puts "Does not exist."  # this is true in my tests
  7.       if File.exist?(File.join('Audio/BGM', name))
  8.         name = (File.join('Audio/BGM', name))
  9.       else
  10.         name = (File.join(Game.audio_path, 'Audio/BGM', name))
  11.       end
  12.     end
  13.     __init_wo_ext_resolv_(name, ext)  # The alias to the C function
  14.    
  15.     # When this ^^^^ is called, it seems that name is not changed at all?
  16.   end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment