使用 Delphi 10 在 Android 上错误地返回空文件列表

Incorrectly returning empty file list on Android with Delphi 10

我想从我的系统创建一个日志文件列表,但是 GetFiles 函数 returns 在 Android 上是空的,即使文件夹中有几个文件(在Windows 有效)。 我无法识别任何错误或遗漏的内容。有谁知道会发生什么? 注意:在 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;

您使用了 \ 作为路径分隔符。在 Android 上 /。但是不要对其进行硬编码,让 TPath.Combine 为您完成对平台敏感的工作。