[Gambas-user] Path specification

Bruce adamnt42 at gmail.com
Tue Nov 20 14:07:51 CET 2018


Well, I wasn't going to, but I will.

Relative pathing, as it is now, gives you access to the immediate 
executable archive or the ultimate parent archive. It works up the 
dependency chain.

So "./somewhere/something.txt" in an application level archive gives you 
runtime access to a file in the archive for the application itself. If 
the application is "A" then the application, at runtime, access a file 
in its own archive ("A.gambas") in a subdirectory "somewhere" called 
"something.txt". Naturally, this will be read only access. Now this 
means that inside the "A" project, i.e. the source project, not the 
archive, there will be a subdirectory called "somewhere" where 
"something.txt" is located.

A library or (a written in gambas) component can do the same thing. 
After all they are just gambas exxecutable archives. They can access 
files inside their own archive by using the "./" relative path.

They can also do one other thing, they can refer to a file in the top 
level archive, i.e. the running application by using the "../" relative 
path.

This is what I mean by "up the dependency chain".

But this does not in any way convey an ability, nor any abillity, to 
interrogate something DOWN that chain.

Although we are talking about a dependency chain and not an inheritance 
hierarchy, to me a similar principal to inheritance "encapsulation" 
applies here.

If you want to make some static data in a library available further up 
in the dependency chain then you have to construct a method within that 
library that exposes such data to user projects.

 > I don't understand the sentence in the line ***. In a project P I load a
 > component C, in whose project directory the file h.txt is located. The
 > line *** indicates that you can access the file h.txt in P.

So, no. What Benoît was referring to here is something completely 
different to what I think you are trying to do.

best regards
b

On 11/20/18 11:05 PM, Hans Lehmann wrote:
> Am 19.08.18 um 16:51 schrieb Benoît Minisini:
>> "./gb.xxx/abcd" --> 'abcd' in the 'gb.xxx' component if it is actually 
>> loaded.
>>
>> I'm still looking for better syntaxes that are compatible with the old 
>> ones described in the wiki:
>>
>> - The problem with './gb.xxx/abcd' is that you can't access a 'gb.xxx' 
>> directory in your project without using the 'gb.xxx' syntax directly. 
>> *****
>>
>> - The problem with '.../abcd' is its ugliness.
>>
>> - And so on...
>>
>> Regards,
>>
>> -- 
>> Benoît Minisini
> 
> Hello,
> I don't understand the sentence in the line ***. In a project P I load a 
> component C, in whose project directory the file h.txt is located. The 
> line *** indicates that you can access the file h.txt in P. 
> Unfortunately I don't succeed! What now - what to do?
> 
> With kind regards
> Hans
> 
> 
> ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
> 


More information about the User mailing list