[Gambas-user] Package Wizard - Debian Packages

Rob sourceforge-raindog2 at ...94...
Thu Feb 3 17:24:53 CET 2005


On Thursday 03 February 2005 10:00, Dave sharples wrote:
> 1. Is there an easy way to detect if a program (in this case
> dpkg) is installed on the system ??

I always use either "which foo" or "type foo".... one of those is 
a shell builtin and the other isn't, and for your purposes I'd 
use the one that isn't.

If you would rather do it without shelling out, you'd need to do 
something like

public function findprogram(prog as string) as boolean
dim found as boolean
dim d as string
found = false
for each d in split(Application.Env["PATH"], ":")
	if exist(d &/ prog) then found = true
next
return found
end

Untested, of course, but you get the idea.

Rob







More information about the User mailing list