[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gambas-user
Subject:    Re: [Gambas-user] Relative paths in a component
From:       Benoit Minisini <gambas () users ! sourceforge ! net>
Date:       2012-04-22 15:48:28
Message-ID: CACdQtXfyf22mL2Viu+XXwra_=aO9Qr2=jXjhuq_dQGo9a91c=Q () mail ! gmail ! com
[Download RAW message or body]

I'm not at home but I answer anyway... This magic path already exists. :-)

Just add "../" before the relative path.

Public Sub Open(Path As String)

  Dim fichier As File

  If Left(Path) <> "/" then Path = ".." &/ Path

  ...

2012/4/22 Fabien Bodard <gambas.fr@gmail.com>

> 2012/4/22 Adrien Prokopowicz <adrien.prokopowicz@gmail.com>:
> > 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
>
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>




--
Benoit Minisini
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic