mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Modules - Added IsActivatedOverride which indicates exactly that
Core - During creation ensure all local users can access the data folder Core - Wrap exceptions during module enable/disable in PluginExceptions
This commit is contained in:
1 parent
6672b1d6b0
commit
cf87410a50
4 files changed
+65
-16
No files matched your search
@@ -1,13 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Threading;
|
||||
using Artemis.Core.Models.Profile.Conditions;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Ninject;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.UI.Ninject;
|
||||
@@ -37,11 +39,12 @@ namespace Artemis.UI
|
||||
|
||||
protected override void Launch()
|
||||
{
|
||||
StartupArguments = Args.ToList();
|
||||
|
||||
var logger = Kernel.Get<ILogger>();
|
||||
var viewManager = Kernel.Get<IViewManager>();
|
||||
|
||||
StartupArguments = Args.ToList();
|
||||
CreateDataDirectory(logger);
|
||||
|
||||
// Create the Artemis core
|
||||
try
|
||||
{
|
||||
@@ -113,6 +116,29 @@ namespace Artemis.UI
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void CreateDataDirectory(ILogger logger)
|
||||
{
|
||||
// Ensure the data folder exists
|
||||
if (Directory.Exists(Constants.DataFolder))
|
||||
return;
|
||||
|
||||
logger.Information("Creating data directory at {dataDirectoryFolder}", Constants.DataFolder);
|
||||
Directory.CreateDirectory(Constants.DataFolder);
|
||||
|
||||
// During creation ensure all local users can access the data folder
|
||||
// This is needed when later running Artemis as a different user or when Artemis is first run as admin
|
||||
var directoryInfo = new DirectoryInfo(Constants.DataFolder);
|
||||
var accessControl = directoryInfo.GetAccessControl();
|
||||
accessControl.AddAccessRule(new FileSystemAccessRule(
|
||||
new SecurityIdentifier(WellKnownSidType.BuiltinUsersSid, null),
|
||||
FileSystemRights.FullControl,
|
||||
InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit,
|
||||
PropagationFlags.InheritOnly,
|
||||
AccessControlType.Allow)
|
||||
);
|
||||
directoryInfo.SetAccessControl(accessControl);
|
||||
}
|
||||
|
||||
private void HandleFatalException(Exception e, ILogger logger)
|
||||
{
|
||||
logger.Fatal(e, "Fatal exception during initialization, shutting down.");
|
||||
|
||||
Reference in new issue
Block a user