Skip to content

Commit

Permalink
WinSW should handle whitespace in the argument correctly
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.kenai.com/svn/winsw~subversion/trunk@43 c8b2a3fe-9b5b-6a51-a37e-dc31b0e308fa
  • Loading branch information
kohsuke committed Feb 9, 2010
1 parent 08e8778 commit 83380bd
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public string Stoparguments

/// <summary>
/// Combines the contents of all the elements of the given name,
/// or return null if no element exists.
/// or return null if no element exists. Handles whitespace quotation.
/// </summary>
private string AppendTags(string tagName)
{
Expand All @@ -196,7 +196,21 @@ private string AppendTags(string tagName)

foreach (XmlNode argument in dom.SelectNodes("//" + tagName))
{
arguments += " " + argument.InnerText;
string token = argument.InnerText;
if (token.StartsWith("\"") && token.EndsWith("\""))
{
// for backward compatibility, if the argument is already quoted, leave it as is.
// in earlier versions we didn't handle quotation, so the user might have worked
// around it by themselves
}
else
{
if (token.Contains(" "))
{
token = '"' + token + '"';
}
}
arguments += " " + token;
}

return Environment.ExpandEnvironmentVariables(arguments);
Expand Down

0 comments on commit 83380bd

Please sign in to comment.