improve installationmanager

This commit is contained in:
Shaun Walker
2019-09-20 08:50:55 -04:00
parent 83a212e7e3
commit c3ff9ff12b
7 changed files with 52 additions and 42 deletions

View File

@ -1,7 +0,0 @@
namespace Oqtane.Infrastructure
{
public interface IInstallation
{
void Install(string Folders);
}
}

View File

@ -0,0 +1,7 @@
namespace Oqtane.Infrastructure
{
public interface IInstallationManager
{
void InstallPackages(string Folders);
}
}

View File

@ -6,18 +6,18 @@ using Microsoft.AspNetCore.Hosting;
namespace Oqtane.Infrastructure
{
public class Installation : IInstallation
public class InstallationManager : IInstallationManager
{
private readonly IHostApplicationLifetime HostApplicationLifetime;
private readonly IWebHostEnvironment environment;
public Installation(IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
public InstallationManager(IHostApplicationLifetime HostApplicationLifetime, IWebHostEnvironment environment)
{
this.HostApplicationLifetime = HostApplicationLifetime;
this.environment = environment;
}
public void Install(string Folders)
public void InstallPackages(string Folders)
{
bool install = false;
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
@ -26,6 +26,12 @@ namespace Oqtane.Infrastructure
{
string folder = Path.Combine(environment.WebRootPath, Folder);
// create folder if it does not exist
if (!Directory.Exists(folder))
{
Directory.CreateDirectory(folder);
}
// iterate through theme packages
foreach (string packagename in Directory.GetFiles(folder, "*.nupkg"))
{