[Gambas-user] Concatenate two path strings

BB adamnt42 at gmail.com
Sun Oct 1 05:23:02 CEST 2023


I have two strings representing a "base" path and a "relative" path, so 
that, for instance
     basepath = "/home/me/ahab/bhab" ' or sometimes "/home/me/ahab/bhab/"
     relpath = "../../img/etc" ' or sometimes "img/etc" or "/img/etc" or 
./img/etc" or anything else that the user has constructed the relative 
path as

I know I can get a full path just by concatenting using &/ i.e.
     fullpath = basepath &/ relpath

which seems to work but results often in a crazy looking path. Short of 
manually parsing the basepath and relpath variables into some sort of 
standard using a lot of ifs, is there a simple Gambas way of getting the 
proper path string? I can't find one.

Or even a external call to something that could resolve this. Strangely 
in all my years of using Gambas I have never had this need before.

tia

bruce



More information about the User mailing list