mirror of
https://github.com/4sval/FModel.git
synced 2026-03-22 01:34:37 -05:00
Fix 1 for admin accounts
This commit is contained in:
parent
de00c36a14
commit
396655f105
|
|
@ -5,7 +5,7 @@
|
|||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8FABCD3A-9D55-4B54-B237-B259D815DEB8}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>FModel</RootNamespace>
|
||||
<AssemblyName>FModel</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ScintillaNET_FindReplaceDialog;
|
||||
using System.Security.Principal;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace FModel
|
||||
{
|
||||
|
|
@ -181,6 +183,21 @@ namespace FModel
|
|||
if (!Directory.Exists(DefaultOutputPath + "\\Sounds\\"))
|
||||
Directory.CreateDirectory(DefaultOutputPath + "\\Sounds\\");
|
||||
}
|
||||
public static void SetFolderPermission(string folderPath)
|
||||
{
|
||||
var directoryInfo = new DirectoryInfo(folderPath);
|
||||
var directorySecurity = directoryInfo.GetAccessControl();
|
||||
var currentUserIdentity = WindowsIdentity.GetCurrent();
|
||||
var fileSystemRule = new FileSystemAccessRule(currentUserIdentity.Name,
|
||||
FileSystemRights.Read,
|
||||
InheritanceFlags.ObjectInherit |
|
||||
InheritanceFlags.ContainerInherit,
|
||||
PropagationFlags.None,
|
||||
AccessControlType.Allow);
|
||||
|
||||
directorySecurity.AddAccessRule(fileSystemRule);
|
||||
directoryInfo.SetAccessControl(directorySecurity);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LOAD & LEAVE
|
||||
|
|
@ -344,6 +361,7 @@ namespace FModel
|
|||
setScintillaStyle();
|
||||
setFont();
|
||||
setOutput();
|
||||
SetFolderPermission(DefaultOutputPath);
|
||||
createDir();
|
||||
keyCheck();
|
||||
johnWickCheck();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user