I looked at the fild_list.pixi example and try to play around it with different folder path.
The default example uses CURRENT_PATH, and it works as expected, showing every single file names in the folder;
however, I tried to insert an invalid path that is clearly not exists (FOOBARNOTEYYEP:/clearly not existed/56pb0934e790567wq0349vg756w):
Code: Select all
include "../show_log.pixi"
path = "FOOBARNOTEYYEP:/clearly not existed/56pb0934e790567wq0349vg756w"
mask = -1 //Examples: "txt/doc", "avi"; or -1 for all files.
fl = new_flist( path, mask )
if fl >= 0
{
logf( "Some files found in %s\n", path )
while( 1 )
{
file_name = get_flist_name( fl )
file_type = get_flist_type( fl ) //0 - file; 1 - directory;
if file_type == 0
{
logf( "FILE %s%s\n", path, file_name )
}
else
{
logf( "DIR %s%s\n", path, file_name )
}
if flist_next( fl ) == 0 //Go to the next file
{
//No more files
break
}
}
remove_flist( fl )
}
show_log()
Am I misunderstood how this function work? If this function cannot return -1 for invalid file path, is there any functions can let me check the invalid file path without attempt to open a file? (as the file name is not a constant)