I am trying to load files with an extension .csv into a ListBox but my code is not working on Android platform. What’s wrong with the code?
procedure LoadFileList(aFiles: TStringList; sPath: string; sMask: string = ‘*.*’);
var
iIndex: integer;
SearchRec: TSearchRec;
begin
if sPath[Length(sPath)] <> ” then
sPath := sPath + ”;
iIndex := FindFirst(sPath+sMask, faArchive, SearchRec);
while iIndex = 0 do begin
aFiles.Add(SearchRec.Name);
iIndex := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
Usage:
LoadFileList(TStringList(ListBox1.Items), TPath.GetSharedDocumentsPath, ‘*.csv’);