I’ve already answered this on the newsgroups however it deserves a little more attention.
The most important thing to do when deploying additional files with your app is to make sure they are prefixed with “StartUp/”. This tells the deployment manager to deploy these files with the application and place them in the folder specified after the StartUp/ prefix. This prefix is case sensitive.
Here is a screen capture of the deployment manager for the sample project available for download at the end of this post.
Verify file is included without running the app
You can even verify that the files have been deployed with the app by looking in the Applications section of your device in the XCode Organizer.
The code below loads the content of the file into the WebBrowser control that is on the form.
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types,
FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.WebBrowser, FMX.StdCtrls, FMX.Layouts;
TForm288 = class(TForm)
procedure LoadHtmlButtonClick(Sender: TObject);
procedure TForm288.LoadHtmlButtonClick(Sender: TObject);
LFilename := TPath.GetDocumentsPath + ‘/index.html’;
if TFile.Exists(LFilename) then
WebBrowser1.Navigate(‘file://’ + LFilename)
MessageDlg(Format(‘File not found: %s’, [LFilename]), TMsgDlgType.mtError, [TMsgDlgBtn.mbClose], 0);
Works on my device!
Download the Code
Download the sample project.
A couple of notes
You wouldn’t deploy a static file to the Documents folder unless you wanted it to be backed up (via iTunes or iCloud) with other user data.
The best location for static files is Library/Application Support/, this is content that is generated when the application runs, or is included with the application.