Wednesday, 1 November 2017

how to show the availble files in Android memory with Firemonkey

uses
  IOUtils;

procedure THeaderFooterForm.SpeedButton1Click(Sender: TObject);
var
  DirList: TStringDynArray;
  DirPath: string;
  s: string;
begin
  DirPath := TPath.Combine(TPath.GetDocumentsPath, 'assets');
  DirPath := TPath.Combine(DirPath, 'internal');

  // Display where we're looking for the files
  Memo1.Lines.Add('Searching ' + DirPath);

  if TDirectory.Exists(DirPath, True) then
  begin
    // Get all files. Non-Windows systems don't typically care about
    // extensions, so we just use a single '*' as a mask.
    DirList := TDirectory.GetFiles(DirPath, '*');

    // If none found, show that in memo
    if Length(DirList) = 0 then
      Memo1.Lines.Add('No files found in ' + DirPath)
    else // Files found. List them.
    begin 
      for s in DirList do
        Memo1.Lines.Add(s);
    end;
  end
  else
    Memo1.Lines.Add('Directory ' + DirPath + ' does not exist.');
end;

1 comment:

zomok E-commerce system plan. Choose your online ordering system. No-risk 30 day free trial. Then USD 9/month. No credit card required.

zomok E-commerce system plan. Choose your online ordering system. No-risk 30 day free trial. Then USD 9/month. No credit card required. h...