Skip to content

Commit 46e23d2

Browse files
committed
Fixed a bug with Unix assembly path.
1 parent 1b768b7 commit 46e23d2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/svcutilcore/src/Microsoft/Tools/ServiceModel/SvcUtil/CommandLineParser.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ namespace Microsoft.Tools.ServiceModel.SvcUtil
77
using System.Globalization;
88
using System.Collections.Generic;
99
using System.Text.RegularExpressions;
10+
using System.IO;
1011

1112
internal enum SwitchType
1213
{
@@ -201,7 +202,18 @@ internal static ArgumentDictionary ParseCommand(string[] cmd, CommandSwitch[] sw
201202
//if no match found, then throw an exception
202203
argSwitch = CommandSwitch.FindSwitch(arg.ToLower(CultureInfo.InvariantCulture), switches);
203204
if (argSwitch == null)
205+
{
206+
// Paths start with "/" on Unix, so the arg could potentially be a path.
207+
// If we didn't find any matched option, check and see if it's a path.
208+
string potentialPath = "/" + arg;
209+
if (File.Exists(potentialPath))
210+
{
211+
arguments.Add(string.Empty, potentialPath);
212+
continue;
213+
}
214+
204215
throw new ArgumentException(SR.Format(SR.ErrUnknownSwitch, arg.ToLower(CultureInfo.InvariantCulture)));
216+
}
205217

206218
//check if switch is allowed to have a value
207219
// if not and a value has been specified, then thrown an exception

0 commit comments

Comments
 (0)