Skip to content

Commit

Permalink
Adjusted support old and link adjusted
Browse files Browse the repository at this point in the history
  • Loading branch information
snakeice committed Jul 24, 2019
1 parent 599c52d commit 1cd359c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/core/Boss.Modules.PackageProcessor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,23 @@ function TBossPackageProcessor.GetEnv(AEnv: string): string;
procedure TBossPackageProcessor.MakeLink(AProjectPath, AEnv: string);
var
LCommand: PChar;
LFile: string;
begin
System.TMonitor.Enter(Self);
try
if DirectoryExists(GetEnv(AEnv)) then
TFile.Delete(GetEnv(AEnv));
LCommand := PChar(Format('cmd /c mklink /D /J "%0:s" "%1:s"',
[GetEnv(AEnv), AProjectPath + TPath.DirectorySeparatorChar + C_MODULES_FOLDER + '.' + AEnv]));
ExecuteAndWait(LCommand);

ForceDirectories(GetEnv(AEnv));

for LFile in TDirectory.GetFiles(AProjectPath + TPath.DirectorySeparatorChar + C_MODULES_FOLDER + '.' + AEnv) do
begin
TFile.Copy(LFile, TPath.Combine(GetEnv(AEnv), TPath.GetFileName(LFile)), True);
end;

except
on E: Exception do
TProviderMessage.GetInstance.WriteLn('Failed on make link: ' + E.Message);
end;
System.TMonitor.Exit(Self);
end;

constructor TBossPackageProcessor.Create;
Expand All @@ -110,6 +114,12 @@ constructor TBossPackageProcessor.Create;
if FileExists(GetDataCachePath) then
FDataFile.LoadFromFile(GetDataCachePath);

if not FDataFile.Values[BPLS].IsEmpty then
begin
FDataFile.Delimiter := ';';
FDataFile.DelimitedText := FDataFile.Values[BPLS];
end;

if DirectoryExists(GetEnv(EmptyStr)) then
ForceDirectories(GetEnv(EmptyStr));

Expand Down

0 comments on commit 1cd359c

Please sign in to comment.