Dealing with filenames in a folder...
ianl at mac.com
Tue Oct 18 17:07:44 EDT 2005
I am, as an attempt to learn Dreamcard, writing a frontend to MAME. I
have a fair idea of what I need to do, just doing it is a bit of a
struggle at the moment.
The user points to where their ROM folder is. What I then need to do
is take each filename that ends with .ZIP and convert that into a
full title. At the moment I am cross referencing the filename with a
text file containing the information I need. Displaying the filenames
in a field is easy using the files command and filter to find
the .zips. Because the filename isn't very descriptive I want to use
the descriptions in the text file instead.
So far I have been trying the following....
global allgamedata, ROMlist, ROMtitlelist
local counter, titletoscan, n
answer folder "Where are your ROMs?"
put it into field "ROMlocation"
set the defaultfolder to field "ROMlocation"
put the files into ROMlist
filter ROMlist with ".zip"
put ROMlist into field "gamedescription"
repeat with n = 1 to the number of lines in ROMlist
put line n of ROMlist into titletoscan
put titletoscan into field "filetoscan"
add scantitle(titletoscan) to ROMtitlelist
put ROMtitlelist into field "availablegames"
function scantitle titletoscan
local gametitle, returnedpos
put lineoffset("$info=" & titletoscan, allgamedata) into returnedpos
put line returnedpos + 2 of allgamedata into gametitle
The problem is that the first item in ROMlist is .DSstore and the
whole thing seems to stop there. I could do with a little help if
anyone can assist!
I have been thinking perhaps I should take the filename one at a time
and then create an array to store each game into but don't know if
that is really necessary in rev. The reason this has to be done is
that MAME supports many thousands of roms but the user may only have
More information about the Use-livecode