Skip to content

Commit

Permalink
Quoted the path for the Task, so that install paths with spaces work …
Browse files Browse the repository at this point in the history
…too.
  • Loading branch information
AtlasHackert committed May 20, 2017
1 parent a3ea6d2 commit fcda27f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Console/Helpers/InstallHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ private static bool CreateDefaultRules()
private static bool createTask(bool allUsers)
{
string tmpXML = Path.GetTempFileName();
var taskStr = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Wokhan.WindowsFirewallNotifier.Console.Resources.TaskTemplate.xml"));
var newtask = String.Format(taskStr.ReadToEnd(),
allUsers ? "<UserId>NT AUTHORITY\\SYSTEM</UserId>"//"<GroupId>S-1-5-32-545</GroupId>"
: "<UserId><![CDATA[" + WindowsIdentity.GetCurrent().Name + "]]></UserId>",
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Notifier.exe"),
DateTime.Now.ToString("s"));

taskStr.Close();
string newtask;
using (var taskStr = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("Wokhan.WindowsFirewallNotifier.Console.Resources.TaskTemplate.xml")))
{
newtask = String.Format(taskStr.ReadToEnd(),
allUsers ? "<UserId>NT AUTHORITY\\SYSTEM</UserId>"//"<GroupId>S-1-5-32-545</GroupId>"
: "<UserId><![CDATA[" + WindowsIdentity.GetCurrent().Name + "]]></UserId>",
"\"" + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Notifier.exe") + "\"",
DateTime.Now.ToString("s"));
}

File.WriteAllText(tmpXML, newtask, Encoding.Unicode);

Expand Down

0 comments on commit fcda27f

Please sign in to comment.