🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.commandlinetools
Article #368

Re: installing a package

#368
From: Jens Berke
Date: Thu, 23 Sep 2004 10:34
47 lines
2522 bytes
James wrote:
> I was wondering if it is possible to install a package via the
> command line.  Does anyone know if this is possible and if so, how it
> is achieved?
Yes, you can. You have to write it into the registry and need to restart 
Delphi after that. Here's a rough summary of how you can do it for 
Delphi 5 (newer versions will be similar, I guess). Mmaybe it doesn't 
compile cause it's an extract of my original, much longer code.

// param BPLFile contains complete path and filename to a BPL-file
procedure InstallPackage(BPLFile: string);
var
   j: Integer;
   Reg: TRegistry;
   BorImage: TJclPeBorImage;
   // you need JCL for TJclPeBorImage, see http://jcl.sourceforge.net
begin
   Reg :=  TRegistry.Create;
   try
     Reg.RootKey := HKEY_CURRENT_USER;
     Reg.Access := KEY_ALL_ACCESS;
     if Reg.OpenKey('Software\Borland\Delphi\5.0\Known Packages', False) 
then begin
       try
         BorImage := TJclPeBorImage.Create;
         BorImage.FileName := BPLFile;
         Assert(BorImage.IsPackage);
         if BorImage.Description <> '' then begin
           Reg.WriteString(BPLFile, BorImage.Description);
         end else begin
           Reg.WriteString(BPLFile, BPLFile);
         end;
       finally
         FreeAndNil(BorImage);
         Reg.CloseKey;
       end;
     end;
   finally
     FreeAndNil(Reg);
   end;
end;

Jens

-- 
____________________________________________________________
  email (delete all digits, please): info@11.jensberke.11.de
Technical Details
Message-ID: <4152a6b8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <41528e87$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: ff8f1,53d5fb03fab3bfbe
X-Google-Attributes: gidff8f1,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Thu, 23 Sep 2004 12:34:38 +0200
From: Jens Berke <noreply@jensberke.de>
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.delphi.commandlinetools
Subject: Re: installing a package
References: <41528e87$1@newsgroups.borland.com>
In-Reply-To: <41528e87$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 80.134.64.108
Message-ID: <4152a6b8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1095935672 80.134.64.108 (23 Sep 2004 03:34:32 -0700)
Lines: 47
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail