Skip to content

Commit

Permalink
Fixed arg split with windows paths bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eirannejad committed Nov 7, 2024
1 parent 8602d38 commit 8a46273
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/compute.geometry/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,8 @@ static void ParseCommandLineArgs(string[] args)
{
for (int i = 0; i < args.Length; i++)
{
string[] items = args[i].Split(':');
if (items == null || items.Length != 2)
continue;
string key = items[0].ToLowerInvariant().TrimStart('-');
string value = items[1];
SplitArg(args[i], out string key, out string value);

switch (key)
{
case "port":
Expand Down Expand Up @@ -125,6 +122,23 @@ static void ParseCommandLineArgs(string[] args)
}
}
}

static void SplitArg(string arg, out string key, out string value)
{
key = arg;
value = string.Empty;

int i = arg.IndexOf(":");
if (i > 0)
{
key = arg.Substring(0, i);
value = arg.Substring(i + 1, arg.Length - key.Length - 1);

// cleanup key, value
key = key.ToLowerInvariant().TrimStart('-');
}
}

private static void LogVersions()
{
string compute_version = null, rhino_version = null;
Expand Down

0 comments on commit 8a46273

Please sign in to comment.