Hi,
I'm trying to create a list of images in my folders.
It seems like a pretty straight forward task but it is proving very tricky indeed.
This is my file reading function:
function CreateImageList( list REF as string[], d$ )
SetFolder(d$)
fn$ = GetFirstFile()
if lower(right(fn$, 3)) = "png"
list.insert(fn$)
endif
repeat
fn$ = GetNextFile()
if lower(right(fn$, 3)) = "png"
list.insert(fn$)
endif
until fn$=""
endfunction
and the calling code:
imgList as string[]
CreateImageList( imgList, "" )
do
print("Folder: " + GetFolder())
for k = 0 to imgList.length
print( str(k) + ": " +imgList[k] )
next k
sync()
loop
If I call
CreateImageList( imgList, "" ) with an empty string, I get a list of the default images in an AppGameKit project (virtual joystick etc.) and the folder path is printed as blank
If I call
CreateImageList( imgList, "media" ) then I would expect to get a list of all images in the media folder but no, I get nothing and the folder path is now printed as media/media
If I create a subfolder called media/media then the above code reads it but what I want to do is read the media folder.
How am I supposed to do that?
AGK V2 user - Tier 1 (mostly)