Hi,
this code is a very basic directory crawler. It worked some time ago, now it doesn't, neither with AGKS nor AppGameKit Classic.
It throws the following error:
Error: Failed to find files in folder C:\Users\PSY\Documents/My Music", the app may not have permission to access it in main.agc at line xx
line xx is the following line: folderID = OpenRawFolder ( path )
There is no folder 'My Music' in my Documents directory.
The code works with SetErrorMode(1) and SetErrorMode(0), but not with SetErrorMode(2)!
It DOES work with SetErrorMode(2) on directories other than GetDocumentsPath(), though...
#option_explicit
SetErrorMode ( 2 )
SetWindowSize ( 1024, 768, 0 )
global files as integer
global folders as integer
ScanDir ( GetDocumentsPath() )
repeat
print ( "Scanned " + GetDocumentsPath() )
print ( "Found " + str ( files ) + " file(s) and " + str ( folders ) + " folder(s)" )
Sync()
until GetRawKeyReleased ( 27 )
END
function ScanDir ( path as string )
local i as integer
local folderID as integer
local folderCount as integer
local fileCount as integer
folderID = OpenRawFolder ( path )
folderCount = GetRawFolderNumFolders ( folderID )
fileCount = GetRawFolderNumFiles ( folderID )
inc folders, folderCount
inc files, fileCount
for i = 0 to folderCount-1
ScanDir ( path + "/" + GetRawFolderFolderName ( folderID, i ) )
next i
endfunction
PSY