I have a text file (tags.txt) that i would like to deploy with my app. I then want to load it into a TStringList at start up. As of now for testing purposes, i have it just in a button's onClick event. However, it doesn't seem to work. I have read a number of resources on line, including those from embarcadero and SO. I just do not know what i am doing wrong. I get a "Cannot open file "/data/data/com.embarcadero.PTMMobile/files/tags.txt". No such file or directory.
Here is my code:
var
frmMain: TfrmMain;
AppPath: String;
Tags: TStringList;
implementation
{$R *.fmx}
uses System.IOUtils;
procedure TfrmMain.Button1Click(Sender: TObject);
begin
Tags:= TStringList.Create;
try
AppPath := TPath.Combine(TPath.GetDocumentsPath, 'tags.txt');
Label1.Text:= AppPath;
Tags.LoadFromFile(AppPath);
Label2.Text:= IntToStr(Tags.Count);
finally
Tags.Free;
end;
end;
end.
My remote path is assets\internal

Looking at your screenshot it seems the original file is in the Debug binaries folder of your application. Try to move the file in the project folder and retry (of course you have to re-add the new file location to your deploy options).
The binaries folder may be cleaned up at each build, deleting your original file just before trying to deploy it to the device.
Hth
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With