I dont know if this is something I am doing or if it is a bug in GLBasic
I am loading my graphics and then switching to a folder containing MP3s which will play at random
My code is this
SETCURRENTDIR("Media") // seperate media and binaries?
LOADFONT "smallfont.png", 1
LOADFONT "medfont.png",2
LOADFONT "largefont.png",3
LOADSPRITE "num0.png",0
LOADSPRITE "num1.png",1
LOADSPRITE "num2.png",2
LOADSPRITE "num3.png",3
LOADSPRITE "num4.png",4
LOADSPRITE "num5.png",5
LOADSPRITE "num6.png",6
LOADSPRITE "num7.png",7
LOADSPRITE "num8.png",8
LOADSPRITE "num9.png",9
LOADSPRITE "bg.png",200
SETCURRENTDIR("MP3")
musiccount = GETFILELIST("*.mp3",list$[])
I have 2 directories in my project folder Media and MP3 and I would have expected SETCURRENTDIR("MP3") to have switched to the MP3 folder but the files returned by GETFILELIST are the ones in Media.
Is it a bug or am I being stupid?
Thanks
Gary
This works (ie gets the list of files in MEDIA/MP3) :
SETCURRENTDIR("Media")
SETCURRENTDIR("MP3")
GETFILELIST("*.*",list$[])
FOREACH a$ IN list$[]
DEBUG a$+"\n"
NEXT
Are you sure that your directory is like MEDIA/MP3 and not in a directory in another directory ?
ah ok, so setcurrentdir is recursive from the current directory then. That explains it.
Changed my code to setcurrentdir("../mp3") and it works fine now
Thanks for the help
Yes, it's based from the current directory, which is how it should be...