Commit 02045d0e authored by Leander Schulten's avatar Leander Schulten
Browse files

WindowsInstaller: Copy the permissions of the old folder and apply them to the new folder

parent 69d2c7db
Pipeline #190812 passed with stage
in 4 minutes and 21 seconds
......@@ -17,6 +17,7 @@ namespace WindowsInstaller
{
string from;
string to;
System.Security.AccessControl.DirectorySecurity folderAccessControl;
enum Progress{ Wait, Remove, Copy};
Progress progress = Progress.Wait;
......@@ -102,6 +103,9 @@ namespace WindowsInstaller
});
if(progress == Progress.Wait)
{
// save the permissions of the old folder
folderAccessControl = Directory.GetAccessControl(to);
folderAccessControl.SetAccessRuleProtection(false, true);
try
{
DeleteDirectory(to);
......@@ -134,6 +138,8 @@ namespace WindowsInstaller
try
{
Directory.Move(from, to);
// set the old permissions to the new folder
Directory.SetAccessControl(to, folderAccessControl);
}
catch (Exception ex)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment