Skip to content

Commit

Permalink
Check if Configuration Manager Console is installed during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
trondr committed Apr 17, 2018
1 parent 02c2607 commit 1136d57
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ public CreateApplicationFromDefinitionCommandProvider(

public int CreateApplicationFromDefinition(string packageDefinitionFileName)
{
var configurationManagerConsoleIsInstalled = F.GetAdminConsoleBinPath().Match(path => true, exception =>
{
typeof(CreateApplicationFromDefinitionCommandProvider).Logger().Error(exception.Message);
return false;
});
if (!configurationManagerConsoleIsInstalled)
return 1;

var packageDefinitionFile = _packageDefinitionFileProvider.GetPackageDefinitionFile(packageDefinitionFileName);
_logger.InfoFormat("Creating application from package definition file '{0}'...", packageDefinitionFile.FileName);
var packageDefinition = _packageDefinitionProvider.ReadPackageDefinition(packageDefinitionFile.FileName);
Expand Down
9 changes: 5 additions & 4 deletions src/SccmTools/AssemblyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using LanguageExt;
using SccmTools.Library.Module;
using static LanguageExt.Prelude;

namespace SccmTools
{
Expand Down Expand Up @@ -163,14 +164,14 @@ private static byte[] GetAssemblyData(this Assembly resourceAssembly, string res
return null;
}

private static IEnumerable<string> SearchPaths()
private static Func<IEnumerable<string>> SearchPaths => fun(() =>
{
var searchPath = F.GetAdminConsoleBinPath().Match(path => path.Value, exception =>
{
typeof(AssemblyResolver).Logger().Error(exception.Message);
return string.Empty;
});
return string.IsNullOrWhiteSpace(searchPath) ? new string[] { } : new[] {searchPath};
}
return string.IsNullOrWhiteSpace(searchPath) ? new string[] { } : new[] {searchPath};
}).Memo();
}
}

0 comments on commit 1136d57

Please sign in to comment.