[Gambas-user] Library and File
Tobias Boege
taboege at gmail.com
Wed Nov 14 10:00:31 CET 2018
On Wed, 14 Nov 2018, Hans Lehmann wrote:
> Hello.
>
> How do I access a mylibhelp.txt help file - which I have a library
> myLib.gambas - from my project with the ProjectXY that included this
> library?
> I want to access a mylibhelp.txt file from a ProjectXY project, which is
> located in the myLib.gambas library. The library is integrated into the
> project ProjectXY.
>
There was a comment about that recently [1]. I have not paid attention
to whether this was implemented already or not. What you ask is not
directly possible without the new syntax
> "./gb.xxx/abcd" --> 'abcd' in the 'gb.xxx' component if it is actually loaded.
proposed in that email. The latest state of affairs I'm aware of is that
you can use "./file" or "file" to access a file inside the current project
or component and "../file" to access a file inside the currently running
project *from* code running in a component; see [2].
What you can do, which is guaranteed to work, is *ask* the component
to give you that help file instead of trying to snitch it. Add a Help.class
to the component, which executes File.Load("mylibhelp.txt") and returns
the loaded string. Since File.Load(<relative-path>) is executed inside
component code now, it has access to the help file located inside the
component directory.
Regards,
Tobi
[1] https://lists.gambas-basic.org/pipermail/user/2018-August/065319.html
[2] http://gambaswiki.org/wiki/cat/path
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list