|
@ -1,4 +1,7 @@ |
|
|
using System; |
|
|
|
|
|
|
|
|
using IPA.Logging; |
|
|
|
|
|
using System; |
|
|
|
|
|
using System.Diagnostics; |
|
|
|
|
|
using System.Diagnostics.CodeAnalysis; |
|
|
using System.IO; |
|
|
using System.IO; |
|
|
using System.Security.AccessControl; |
|
|
using System.Security.AccessControl; |
|
|
using System.Security.Principal; |
|
|
using System.Security.Principal; |
|
@ -10,13 +13,16 @@ using Net3_Proxy; |
|
|
namespace IPA.Injector |
|
|
namespace IPA.Injector |
|
|
{ |
|
|
{ |
|
|
internal static class PermissionFix |
|
|
internal static class PermissionFix |
|
|
{ |
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
[SuppressMessage("Reliability", "CA2008:Do not create tasks without passing a TaskScheduler", |
|
|
|
|
|
Justification = "I very explicitly want the default scheduler")] |
|
|
public static Task FixPermissions(DirectoryInfo root) |
|
|
public static Task FixPermissions(DirectoryInfo root) |
|
|
{ |
|
|
{ |
|
|
if (!root.Exists) return new Task(() => { }); |
|
|
if (!root.Exists) return new Task(() => { }); |
|
|
|
|
|
|
|
|
return Task.Factory.StartNew(() => |
|
|
return Task.Factory.StartNew(() => |
|
|
{ |
|
|
{ |
|
|
|
|
|
var sw = Stopwatch.StartNew(); |
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
var acl = root.GetAccessControl(); |
|
|
var acl = root.GetAccessControl(); |
|
@ -56,9 +62,11 @@ namespace IPA.Injector |
|
|
} |
|
|
} |
|
|
catch (Exception e) |
|
|
catch (Exception e) |
|
|
{ |
|
|
{ |
|
|
Logging.Logger.log.Warn("Error configuring permissions in the game install dir"); |
|
|
|
|
|
Logging.Logger.log.Warn(e); |
|
|
|
|
|
|
|
|
Logger.log.Warn("Error configuring permissions in the game install dir"); |
|
|
|
|
|
Logger.log.Warn(e); |
|
|
} |
|
|
} |
|
|
|
|
|
sw.Stop(); |
|
|
|
|
|
Logger.log.Info($"Configuring permissions took {sw.Elapsed}"); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|