Print usage instructions on invalid or missing arguments.

This commit is contained in:
the_fiddler 2009-02-28 16:26:25 +00:00
parent bf88e453a8
commit 12db0e6cef

View file

@ -68,6 +68,12 @@ namespace OpenTK.Build
static void Main(string[] args) static void Main(string[] args)
{ {
if (args.Length == 0)
{
PrintUsage();
return;
}
RootPath = Directory.GetCurrentDirectory(); RootPath = Directory.GetCurrentDirectory();
RootPath = RootPath.Substring( RootPath = RootPath.Substring(
0, 0,
@ -81,75 +87,68 @@ namespace OpenTK.Build
Environment.SetEnvironmentVariable("CommonProgramFiles(x86)", String.Empty, EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("CommonProgramFiles(x86)", String.Empty, EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable("ProgramFiles(x86)", String.Empty, EnvironmentVariableTarget.Process); Environment.SetEnvironmentVariable("ProgramFiles(x86)", String.Empty, EnvironmentVariableTarget.Process);
if (args.Length == 0) foreach (string s in args)
{ {
PrintUsage(); string arg = s.ToLower();
} switch (arg)
else
{
foreach (string s in args)
{ {
string arg = s.ToLower(); case "debug":
switch (arg) case "d":
{ mode = BuildMode.Debug;
case "debug": break;
case "d":
mode = BuildMode.Debug;
break;
case "release": case "release":
case "r": case "r":
mode = BuildMode.Release; mode = BuildMode.Release;
break; break;
case "mono": case "mono":
target = BuildTarget.Mono; target = BuildTarget.Mono;
break; break;
case "net": case "net":
target = BuildTarget.Net; target = BuildTarget.Net;
break; break;
case "monodev": case "monodev":
case "monodevelop": case "monodevelop":
case "md": case "md":
target = BuildTarget.MonoDevelop; target = BuildTarget.MonoDevelop;
break; break;
case "sharpdev2": case "sharpdev2":
case "sharpdevelop2": case "sharpdevelop2":
case "sd2": case "sd2":
target = BuildTarget.SharpDevelop2; target = BuildTarget.SharpDevelop2;
break; break;
case "sharpdev": case "sharpdev":
case "sharpdevelop": case "sharpdevelop":
case "sd": case "sd":
target = BuildTarget.SharpDevelop; target = BuildTarget.SharpDevelop;
break; break;
case "vs2005": case "vs2005":
case "vs": case "vs":
target = BuildTarget.VS2005; target = BuildTarget.VS2005;
break; break;
case "clean": case "clean":
target = BuildTarget.Clean; target = BuildTarget.Clean;
break; break;
case "svnclean": case "svnclean":
target = BuildTarget.SVNClean; target = BuildTarget.SVNClean;
break; break;
case "distclean": case "distclean":
target = BuildTarget.DistClean; target = BuildTarget.DistClean;
break; break;
default: default:
Console.WriteLine("Unknown command: {0}", s); Console.WriteLine("Unknown command: {0}", s);
PrintUsage(); PrintUsage();
return; return;
}
} }
BinPath = Path.Combine("Binaries", mode == BuildMode.Debug ? "Debug" : "Release"); BinPath = Path.Combine("Binaries", mode == BuildMode.Debug ? "Debug" : "Release");