Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Commit

Permalink
Given up on getting graphical sudo to work on mac for now
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackDragonBE committed Apr 3, 2018
1 parent 233cbce commit f8dd410
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Binary file not shown.
Binary file added MarkdownToRW/CoreUpdater/AddWritePermissions.scpt
Binary file not shown.
6 changes: 6 additions & 0 deletions MarkdownToRW/CoreUpdater/CoreUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@
<OutputPath>bin\Release\netcoreapp2.0\</OutputPath>
</PropertyGroup>

<ItemGroup>
<None Update="AddWritePermissions.scpt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
18 changes: 12 additions & 6 deletions MarkdownToRW/MarkdownConverter/Utility/DragonUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,18 +228,24 @@ public static void TryToMakeExecutable(string filePath)
{
info.FileName = "gksudo";
info.Arguments = "chmod +x " + SurroundWithQuotes(filePath);

Process p = new Process { StartInfo = info };
p.Start();
p.WaitForExit();

}
else
{
info.FileName = "osascript";
info.Arguments = "-e 'do shell script " + SurroundWithQuotes("chmod +x " + SurroundWithSingleQuotes(filePath)) + " with administrator privileges'";
//string scriptPath = Directory.GetParent(filePath).FullName;
//info.FileName = "osascript";
//info.Arguments = "-e 'do shell script " + SurroundWithQuotes("chmod +x " + SurroundWithSingleQuotes(filePath)) + " with administrator privileges'";
//info.Arguments = SurroundWithSingleQuotes(scriptPath + "/AddWritePermissions.scpt");

info.FileName = "sudo";
info.Arguments = "chmod +x" + SurroundWithSingleQuotes(filePath);
}

Console.WriteLine(info.FileName + " " + info.Arguments);

Process p = new Process {StartInfo = info};
p.Start();
p.WaitForExit();
}
catch (Exception e)
{
Expand Down

0 comments on commit f8dd410

Please sign in to comment.