Trouble with Paths?

  

By user3597837 I have a problem where I am creating an Android app using Firemonkey in Delphi XE6. The app consists of a TWebBrowser and a button…nothing fancy.
I am TRYING to display an xhtml file that is located on my SD card.
I “think” I am doing all the right things like using “TPath.GetHomePath” and putting my file in this location. – and made sure the permissions are set in the project.

Being a seasoned developer, I know that I need to use “file://” so the browser knows it a local file, as I have done a million times in Delphi over the years, and even checking the help file which uses the example “WebBrowser1.Navigate(‘file://MyFile.pdf’)”

So I construct my URL by doing :

AppPath := TPath.Combine(TPath.GetHomePath, ‘myfile.xhtml’);

I then go:

WebBrowser1.Navigate(‘file://’+AppPath);

When the navigation happens, it tells me the file doesn’t exist, file:///data/data/com.embarcadero.WebBrowser/files/myfile.xhtml
I spotted the 3 /’s i.e. file:/// and thought I would just hard coded the path into a string and got the same problem saying the file doesn’t exists and it reverting back to file:///

Can anyone see what I am doing wrong? its got me puzzled thats for sure! 🙂

Thanks, Jeremy …read more

Via: StackOverflow

Comments are closed.