Posted: 9th Nov 2023 20:09
+ Code Snippet
function ProcessFiles(folder as string)
    f as integer
    i as integer
    name as string
    
    PrintLine(folder)
    PrintRefresh()
    
    folder = SimplifyPath(folder)+"/"
                
    f = OpenRawFolder("raw:"+folder) 
    
    for i=0 to GetRawFolderNumFiles(f) - 1
        name = folder+GetRawFolderFileName(f, i)
        ProcessFile(name)
    next

    for i=0 to GetRawFolderNumFolders(f) - 1
        name = folder+GetRawFolderFolderName(f, i)
        ProcessFiles(name)
    next

    CloseRawFolder(f)
    
endfunction
Posted: 18th Nov 2023 9:10
Hi

On android, it only show some specifics files (image png, jpg, wav, mp3) and not .txt or .obj.

I don't know why we don't have access to these files


+ Code Snippet
// Project: readexternal 
// Created: 2023-11-18

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "readexternal" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

permission$ = "WriteExternal"
if ( CheckPermission( permission$ ) <= 0 )
	RequestPermission( permission$ )
	while( CheckPermission( permission$ ) = 1 )
			Sync()
	endwhile
endif

type tFolder
	listfile as string[]
Endtype


global dim listfile[] as string
global dim listFolder[] as tFolder


if GetDeviceBaseName() ="android"
	ProcessFiles("/sdcard/Documents/myfolder")
else
	ProcessFiles(GetDocumentsPath()+"/myfolder")
endif

do
    for i=0 to listfile.length
		print(listfile[i])
	next
	
    Print( ScreenFPS() )
    Sync()
loop


function ProcessFiles(folder as string)
    f as integer
    i as integer
    name as string
     
    //~ PrintLine(folder)
    //~ PrintRefresh()
     
    folder = SimplifyPath(folder)+"/"
                 
    f = OpenRawFolder("raw:"+folder) 
     
    for i=0 to GetRawFolderNumFiles(f) - 1
        name = folder+GetRawFolderFileName(f, i)
        listfile.length = i
        listfile[i] = name
        //~ ProcessFiles(name)
    next
 
    for i=0 to GetRawFolderNumFolders(f) - 1
        name = folder+GetRawFolderFolderName(f, i)
        ProcessFiles(name)
    next
 
    CloseRawFolder(f)
     
endfunction