Skip to content

Commit

Permalink
Merge pull request KSP-CKAN#61 from mgsdk/ckan_support_issue_2_permis…
Browse files Browse the repository at this point in the history
…sions_fix

Ckan support issue 2 permissions fix
  • Loading branch information
AlexanderDzhoganov committed Mar 4, 2015
2 parents b325e59 + 601a9ba commit 41e917d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions SettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,28 @@ private void ResetAutoStartChoice_Click(object sender, EventArgs e)
{
Main.Instance.Manager.ClearAutoStart();

// Mono throws an uninformative error if the file we try to run is not flagged as executable, mark it as such.
if (Util.IsLinux)
{
// Create the command with the filename of the currently running assembly.
string command = string.Format("+x \"{0}\"", System.Reflection.Assembly.GetExecutingAssembly().Location);

ProcessStartInfo permsinfo = new ProcessStartInfo("chmod", command);
permsinfo.UseShellExecute = false;

// Execute the command.
Process permsprocess = Process.Start(permsinfo);

// Wait for chmod to finish and check the exit code.
permsprocess.WaitForExit();

// chmod returns 0 for successfull operation.
if (permsprocess.ExitCode != 0)
{
throw new Kraken("Could not mark CKAN as executable.");
}
}

ProcessStartInfo sinfo = new ProcessStartInfo(System.Reflection.Assembly.GetExecutingAssembly().Location);
sinfo.UseShellExecute = false;

Expand Down

0 comments on commit 41e917d

Please sign in to comment.