Recent

Author Topic: LAMW: Sub-folders of assets folder  (Read 244 times)

Manlio

  • Jr. Member
  • **
  • Posts: 57
  • Pascal dev
LAMW: Sub-folders of assets folder
« on: August 02, 2019, 08:54:06 am »
Is there a way to get a list of the subfolders of the "assets" folder?
manlio mazzon gmail

jmpessoa

  • Hero Member
  • *****
  • Posts: 1470
Re: LAMW: Sub-folders of assets folder
« Reply #1 on: August 03, 2019, 07:19:35 am »
You can try:

Code: Pascal  [Select]
  1. procedure TAndroidModule1.jButton1Click(Sender: TObject);
  2. var
  3.   list: TDynArrayOfString;
  4.   count, i: integer;
  5.   ext: string;
  6. begin
  7.    
  8.    list:= Self.GetAssetContentList('');  //root  
  9.    
  10.    //list:= Self.GetAssetContentList('subfolder1');
  11.    //list:= Self.GetAssetContentList('subfolder1/subfolder2');
  12.  
  13.    count:= Length(list);
  14.    ShowMessage('count = ' + IntToStr(count));
  15.  
  16.    for i:= 0 to count-1 do
  17.    begin
  18.       ext := ExtractFileExt(list[i]);
  19.       if ext = '' then
  20.          ShowMessage('folder "'+list[i]+'"')
  21.       else
  22.          ShowMessage('file "'+list[i]+'"');
  23.    end;
  24.  
  25.    SetLength(list, 0);
  26.  
  27. end;
  28.  
  29.  
« Last Edit: August 03, 2019, 08:48:56 pm by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

Manlio

  • Jr. Member
  • **
  • Posts: 57
  • Pascal dev
Re: LAMW: Sub-folders of assets folder
« Reply #2 on: August 05, 2019, 10:53:14 am »
Code: [Select]
   list:= Self.GetAssetContentList('');  //root     
   //list:= Self.GetAssetContentList('subfolder1');
   //list:= Self.GetAssetContentList('subfolder1/subfolder2');

Exactly what I was looking for, thank you!
manlio mazzon gmail