05-29-2011, 10:13 AM
You should use the Dir.glob method that returns a list of found files depending on a certain pattern.
If you really don't know the extension :
or with a list of extensions names :
define a constant :
then just use :
If you really don't know the extension :
Code:
if Dir.glob("Audio/SE/" + setting + ".*").length > 0
# Something happens
end
or with a list of extensions names :
define a constant :
Code:
AUDIO_EXT = ".{ogg,wav,mp3,mid,wma}"
Code:
if Dir.glob("Audio/SE/" + setting + AUDIO_EXT).length > 0
# Something happens
end
Some scripts :
Working on :