I want to create a list of log files from my system, but the GetFiles
function returns empty on Android, even though there are several files in the folder (on Windows works).
I can't identify anything wrong or missing. Does anyone know what might be happening?
NOTE: Tests made on Android 4.4, Delphi 10.2.1, Windows 10
var LList: TStringDynArray;
const
ROOT_FOLDER = 'AAA';
LOG_FOLDER = 'BBB';
begin
LList := TDirectory.GetFiles(
System.IOUtils.TPath.Combine(
System.IOUtils.TPath.GetDocumentsPath, ROOT_FOLDER + '\' + LOG_FOLDER));
ShowMessage(IntToStr(Length(LList))); // returns zero!!
end;
You've used a \
as the path separator. It's /
on Android. But don't hardcode it, let TPath.Combine
do the platform sensitive work for you.