Dealing with filenames in a folder...
Chipp Walters
chipp at chipp.com
Tue Oct 18 17:23:07 EDT 2005
Ian,
You need to:
filter ROMlist with "*.zip"
best,
Chipp
Ian Leigh wrote:
> 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
>
> on mouseUp
> 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
> end repeat
> put ROMtitlelist into field "availablegames"
>
> end mouseUp
>
> function scantitle titletoscan
> local gametitle, returnedpos
> put lineoffset("$info=" & titletoscan, allgamedata) into returnedpos
> put line returnedpos + 2 of allgamedata into gametitle
> return gametitle
> end scantitle
>
> 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 a handful.
>
> Many thanks
>
> Ian
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
More information about the use-livecode
mailing list