[Gambas-user] Exist with wildcard

bb adamnt42 at gmail.com
Wed Aug 4 12:38:36 CEST 2021

On Wed, 2021-08-04 at 17:46 +0930, bb wrote:
> I am trying to determine if a particular library has been installed
> in
> a particular diectory. 
> I was sure Exist(path) took wildcards into account, but it doen't
> seem
> so.  Any ideas on how to do a wildcard search for a file then?
> e.g. I am looking for "ph.internals:*.gambas" in "/srv/gbshared/lib".
> The actual file is "ph.internals:1.0.gambas" i.e. it has the library
> version included in it, but I don't know WHAT version I am looking
> for.
> tia
> bruce
OK, long explanation.

1) I presume that everyone knows the various places that the executable
for a gambas library project can end up and the order in which they are

2) We have a shared directory "/srv/gbshare/paddys-hill/" where we
place stable versions of our libraries for all co-op members to use in
other projects.

3) When someone is maintaining a library, their "testing" executable
ends up in "~/.local/lib/gambas3/paddys-hill". That way they can code
and test in their own "sandbox" so to speak.

4) I am writing a standalone utility project to help the library
developer :
  a) remove their own ~/.local/lib/gambas3/paddys-hill executable 
  b) cleanup and recompile the library project to the shared area
  c) if necessary, remove any earlier versions from the various places
library executables can exist.

5) the gambas compiler creates an executable for libraries as
<projectid>:<version>.gambas which is fine.

However, in order to do all the things in 4) I need to check for the
existance of "any" version of the library is various places, no matter
what <version> in the filename.

Exist(filename) does not support wildcards.

So my question is very simple.

Does anyone have a good idea as to doing an existance check, like
Exist(), that does cope with a wildcard? Nothing more. I dont care what
the actual <version> part of the filename is (I get that elsewhere). I
don't need to display anything. I don't care if there is more than one
file (which there can't be, anyway). Just is there a file named, for
instance, "xyzzy:*.gambas" where * will be the gambas <version> in the
directory I am looking at.


More information about the User mailing list