[Gambas-user] Relative paths in a component

Fabien Bodard gambas.fr at ...626...
Sun Apr 22 13:53:48 CEST 2012


2012/4/22 Adrien Prokopowicz <adrien.prokopowicz at ...626...>:
> Hi Benoît,
>
> In gb.xml, in XmlReader, i'm loading a file through the Open instruction :
>
> Public Sub Open(path As String)
>
>  Dim fichier As File
>
>  fichier = Open path For Input
>  Me.InputStream = fichier
>
> End
>
> But when path is a relative path, it refers to the project of the component,
> not to the user's project. So the interpreter doesn't find the file, and raises
> an error.
>
> How can I make relative paths referring to the good file ?
>

a solution will be to add a magic path... in open funtion
relative:
project:/file.xml


so

open "project:/file.xml" for read

will open the main project file

this tool must work with all file tools such as exist
-- 
Fabien Bodard




More information about the User mailing list