Using a relative file path for a WebView URL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using a relative file path for a WebView URL

adamnt42@gmail.com
I am trying to get a WebViewer control in a loaded library to display an html file stored inside the executable archive of a project using that library.
This appears to be not possible ... in the following the main project is calling the library form Run method with a relative path say "../help/html/index.html" (Note the use of the ../ to get the calling programs executable relative path!). The library code is as follows:

Public Sub Run (path As string)
        If Exist(path &/ "index.html") Then
    Debug path &/ "index.html exists"
    wvwPage.URL = path &/ "index.html"
        Debug wvwPage.URL

FHSView.Run.10: ../help/html/index.html exists
FHSView.Run.13: file:///home/ksshare/gb3projects/Tools/help/html/index.html

From the above debug output it appears that the WebView control is "subverting" the actual path back into an absolute path.
Any comments?

I think I can extract the entire help directory out of the calling program's executable into the /tmp dir, but I think that then I will have to edit every link in the pages to a path relative to the /tmp dir. Painful!

Has anyone got any better ideas?

bruce
--
B Bruen <[hidden email] (sort of)>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using a relative file path for a WebView URL

T Lee Davidson
wvwPage.HTML = File.Load(path &/ "index.html")   ?


On 06/02/2017 08:57 PM, [hidden email] wrote:

> I am trying to get a WebViewer control in a loaded library to display an html file stored inside the executable archive of a project using that library.
> This appears to be not possible ... in the following the main project is calling the library form Run method with a relative path say "../help/html/index.html" (Note the use of the ../ to get the calling programs executable relative path!). The library code is as follows:
>
> Public Sub Run (path As string)
> If Exist(path &/ "index.html") Then
>       Debug path &/ "index.html exists"
>       wvwPage.URL = path &/ "index.html"
> Debug wvwPage.URL
>
> FHSView.Run.10: ../help/html/index.html exists
> FHSView.Run.13: file:///home/ksshare/gb3projects/Tools/help/html/index.html
>
>  From the above debug output it appears that the WebView control is "subverting" the actual path back into an absolute path.
> Any comments?
>
> I think I can extract the entire help directory out of the calling program's executable into the /tmp dir, but I think that then I will have to edit every link in the pages to a path relative to the /tmp dir. Painful!
>
> Has anyone got any better ideas?
>
> bruce
>

--
Lee

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using a relative file path for a WebView URL

adamnt42@gmail.com
On Sat, 3 Jun 2017 09:13:57 -0400
T Lee Davidson <[hidden email]> wrote:

Thanks Lee, I'll give that a try!
b

> wvwPage.HTML = File.Load(path &/ "index.html")   ?
>
>
> On 06/02/2017 08:57 PM, [hidden email] wrote:
> > I am trying to get a WebViewer control in a loaded library to display an html file stored inside the executable archive of a project using that library.
> > This appears to be not possible ... in the following the main project is calling the library form Run method with a relative path say "../help/html/index.html" (Note the use of the ../ to get the calling programs executable relative path!). The library code is as follows:
> >
> > Public Sub Run (path As string)
> > If Exist(path &/ "index.html") Then
> >       Debug path &/ "index.html exists"
> >       wvwPage.URL = path &/ "index.html"
> > Debug wvwPage.URL
> >
> > FHSView.Run.10: ../help/html/index.html exists
> > FHSView.Run.13: file:///home/ksshare/gb3projects/Tools/help/html/index.html
> >
> >  From the above debug output it appears that the WebView control is "subverting" the actual path back into an absolute path.
> > Any comments?
> >
> > I think I can extract the entire help directory out of the calling program's executable into the /tmp dir, but I think that then I will have to edit every link in the pages to a path relative to the /tmp dir. Painful!
> >
> > Has anyone got any better ideas?
> >
> > bruce
> >
>
> --
> Lee
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user


--
B Bruen <[hidden email] (sort of)>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...