Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Checking if a file exists without knowing the extension?
#1
Is there a way to check if a file exists without having to know the file extension?

I'm trying to check if a sound effect specified in a setting exists, but I really don't want to have to create a conditional like this: /lazy
Code:
if File.exist?('Audio/SE/'+setting+'.ogg') or File.exist?('Audio/SE/'+setting+'.wav') or File.exist?('Audio/SE/'+setting+'.mp3') or File.exist?('Audio/SE/'+setting+'.mid') or File.exist?('Audio/SE/'+setting+'.wma')
# Something happens
end
Reply }


Messages In This Thread
Checking if a file exists without knowing the extension? - by PK8 - 05-29-2011, 09:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
   Map name as save file name Whisper 9 8,421 05-01-2020, 05:35 PM
Last Post: Whisper
   Script Request - Variables Specific Save File JayRay 2 4,530 04-28-2014, 05:15 AM
Last Post: JayRay
   checking event coordinates? shintashi 4 6,755 05-28-2010, 03:34 PM
Last Post: Jaberwocky
   Can I execute a txt file from a script? deValdr 8 9,702 04-18-2010, 07:34 PM
Last Post: deValdr



Users browsing this thread: