Skip to content

Commit

Permalink
Added current project bpl modules in system path
Browse files Browse the repository at this point in the history
  • Loading branch information
snakeice committed Jun 16, 2019
1 parent 5ce450d commit d0bf2b6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
4 changes: 2 additions & 2 deletions boss_ide.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
<Debugger_RunParams> -debug</Debugger_RunParams>
<VerInfo_Keys>CompanyName=Hashload;FileDescription=Boss IDE Tool;FileVersion=1.0.0.0;InternalName=Boss_ide;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=Boss IDE;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<DCC_Description>Boss IDE Tool</DCC_Description>
<DCC_UsePackage>rtl;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_UsePackage>rtl;DOSCommandDR;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>rtl;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_UsePackage>rtl;DOSCommandDR;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
Expand Down
5 changes: 4 additions & 1 deletion src/IDE/Boss.IDE.Register.pas
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ implementation

uses
ToolsAPI, Winapi.Windows, Boss.IDE.BossInstall, Boss.IDE.PojectListener, Boss.Modules.PackageProcessor,
Vcl.Graphics, DesignIntf, System.Types, Providers.Logo, Providers.Message;
Vcl.Graphics, DesignIntf, System.Types, Providers.Logo, Providers.Message, Boss.Ide.OpenToolApi.Tools;

const
C_INVALID_NOTIFIER = -1;
Expand Down Expand Up @@ -39,7 +39,10 @@ procedure Register;
end;

LProjectManager := (BorlandIDEServices as IOTAProjectManager);

LServices := (BorlandIDEServices as IOTAServices);


LMessageServices := (BorlandIDEServices as IOTAMessageServices);

FNotifierMenuIndex := LProjectManager.AddMenuItemCreatorNotifier(TMenuNotifierBossInstall.Create);
Expand Down
26 changes: 19 additions & 7 deletions src/core/Boss.Modules.PackageProcessor.pas
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
unit Boss.Modules.PackageProcessor;


interface

uses
Expand All @@ -16,16 +15,25 @@ TBossPackageProcessor = class

function GetDataCachePath: string;

procedure LoadTools(AProjectPath: string);
procedure SetBossPath(AProjectPath: string);

constructor Create;
public
procedure LoadBpls(AProjectPath: string);
procedure LoadTools(AProjectPath: string);
procedure UnloadOlds;

class Procedure OnActiveProjectChanged(AProject: string);
class function GetInstance: TBossPackageProcessor;
end;


const
PATH = 'PATH';
BOSS_VAR = 'BOSS_PROJECT';
BPLS = 'BPLS';
DELIMITER = ';';

implementation

uses
Expand All @@ -37,6 +45,11 @@ implementation
var
_Instance: TBossPackageProcessor;

procedure TBossPackageProcessor.SetBossPath(AProjectPath: string);
begin
SetEnvironmentVariable(PChar(BOSS_VAR), PChar(AProjectPath + TPath.DirectorySeparatorChar + C_BPL_FOLDER));
end;

constructor TBossPackageProcessor.Create;
begin
FDataFile := TStringList.Create();
Expand Down Expand Up @@ -69,7 +82,6 @@ function TBossPackageProcessor.GetDataCachePath: string;
C_BOSS_CACHE_FOLDER + TPath.DirectorySeparatorChar + C_DATA_FILE;
end;


class function TBossPackageProcessor.GetInstance: TBossPackageProcessor;
begin
if not Assigned(_Instance) then
Expand All @@ -89,6 +101,7 @@ procedure TBossPackageProcessor.LoadBpls(AProjectPath: string);
LFlag: Integer;
LHnd: NativeUInt;
begin
SetBossPath(AProjectPath);
LBpls := GetBplList(AProjectPath);
for LBpl in LBpls do
begin
Expand All @@ -103,7 +116,7 @@ procedure TBossPackageProcessor.LoadBpls(AProjectPath: string);

if not(LFlag and pfRunOnly = pfRunOnly) and TBossIDEInstaller.InstallBpl(LBpl) then
begin
FDataFile.Add(LBpl);
FDataFile.Values[BPLS] := FDataFile.Values[BPLS] + DELIMITER + LBpl;
TProviderMessage.GetInstance.WriteLn('Instaled: ' + LBpl);
end;
end;
Expand Down Expand Up @@ -155,7 +168,7 @@ procedure TBossPackageProcessor.UnloadOlds;
LMenuItem: TMenuItem;
LIndex: Integer;
begin
for LBpl in FDataFile do
for LBpl in FDataFile.Values[BPLS].Split([DELIMITER]) do
begin
TBossIDEInstaller.RemoveBpl(LBpl);
TProviderMessage.GetInstance.WriteLn('Removed: ' + LBpl);
Expand All @@ -178,7 +191,7 @@ procedure TBossPackageProcessor.UnloadOlds;
NativeServices.MenuEndUpdate;
end;

FDataFile.Clear;
FDataFile.Values[BPLS] := EmptyStr;
FDataFile.SaveToFile(GetDataCachePath);
end;

Expand All @@ -189,4 +202,3 @@ finalization
_Instance.Free;

end.

0 comments on commit d0bf2b6

Please sign in to comment.