Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Add /casesensitive parameter so the command works on linux when the p…
Browse files Browse the repository at this point in the history
…ath contains capital letter (#23947)

* Add /casesensitive parameter so the command works on linux when the path contains capical letter.

* Set casesensitive as default for the path.

* Add an empty line after }
  • Loading branch information
huanwu authored and shmao committed Jan 2, 2018
1 parent fdaa0ad commit c2704a6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
26 changes: 10 additions & 16 deletions src/Microsoft.XmlSerializer.Generator/src/Sgen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,9 @@ private int Run(string[] args)
var errs = new ArrayList();
bool force = false;
bool proxyOnly = false;
bool caseSensitive = false;

try
{
if (args.Length > 0)
{
if (args.Any(s => s.IndexOf("casesensitive", StringComparison.OrdinalIgnoreCase) >= 0))
{
caseSensitive = true;
}
}

for (int i = 0; i < args.Length; i++)
{
string arg = args[i];
Expand All @@ -55,10 +46,8 @@ private int Run(string[] args)
}
}

if (!caseSensitive)
{
arg = arg.ToLower(CultureInfo.InvariantCulture);
}
string originalArg = arg;
arg = arg.ToLower(CultureInfo.InvariantCulture);

if (ArgumentMatch(arg, "?") || ArgumentMatch(arg, "help"))
{
Expand Down Expand Up @@ -87,9 +76,14 @@ private int Run(string[] args)
{
types.Add(value);
}
else if (ArgumentMatch(arg, "casesensitive"))
else if (ArgumentMatch(arg, "assembly"))
{
continue;
if (assembly != null)
{
errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg));
}

assembly = value;
}
else
{
Expand All @@ -100,7 +94,7 @@ private int Run(string[] args)
errs.Add(SR.Format(SR.ErrInvalidArgument, "/assembly", arg));
}

assembly = arg;
assembly = originalArg;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.XmlSerializer.Generator/tests/SGenTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class SgenTests
public static void SgenCommandTest()
{
string codefile = "Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs";
int n = Sgen.Main(new string[] { "Microsoft.XmlSerializer.Generator.Tests.dll", "/force", "/casesensitive" });
int n = Sgen.Main(new string[] { "Microsoft.XmlSerializer.Generator.Tests.dll", "/force"});
Assert.Equal(0, n);
Assert.True(File.Exists(codefile), string.Format("Fail to generate {0}.", codefile));
}
Expand Down

0 comments on commit c2704a6

Please sign in to comment.