In my Delphi application I'm creating a plain text file on Android using the following code:
var lst: TStringList;
begin
lst := TStringList.Create;
lst.Clear;
lst.Add('a');
lst.Add('b');
lst.Add('c');
lst.Add('d');
// Esse path é: /data/data/com.embarcadero.MyApp/files/test.txt
if not TFile.Exists(System.IOUtils.TPath.Combine(System.IOUtils.tpath.getdocumentspath,'test.txt')) then
lst.SaveToFile(System.IOUtils.TPath.Combine(System.IOUtils.tpath.getdocumentspath,'test.txt'));
And I see through Debug that the file is created. When I run the second routine the if not TFile.Exists
also detects that the file already exists.
PROBLEMS:
1) When I try to find the file test.txt
on Android, I even find this directory "/ data / data /...";
2) I do not know is possible on Android, but I would like to save this file in the same program installation folder. In projects with the Delphi VCL I used the path of the Application.ExeName
executable as a reference, which is not supported on Android. Is it possible / indicated to do this on Android?