1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-14 14:24:10 +02:00

Fixed static lib archiving with paths with spaces

This commit is contained in:
Brian Fiete 2021-07-01 12:42:03 -07:00
parent 97a828a12a
commit 23dafd4e6d
2 changed files with 38 additions and 6 deletions

View file

@ -194,14 +194,42 @@ namespace IDE
arCmds.AppendF("CREATE {}\n", targetPath);
void AddObject(StringView obj)
{
if (obj.IsEmpty)
return;
if (obj.EndsWith(".lib", .OrdinalIgnoreCase))
arCmds.AppendF("ADDLIB {}\n", obj);
else
arCmds.AppendF("ADDMOD {}\n", obj);
}
bool inQuote = false;
int lastEnd = -1;
for (int i < objectsArg.Length)
{
var c = objectsArg[i];
if (c == '"')
{
if (inQuote)
AddObject(objectsArg.Substring(lastEnd + 1, i - lastEnd - 1));
inQuote = !inQuote;
lastEnd = i;
}
else if ((c == ' ') && (!inQuote))
{
AddObject(objectsArg.Substring(lastEnd + 1, i - lastEnd - 1));
lastEnd = i;
}
}
AddObject(objectsArg.Substring(lastEnd + 1));
for (let obj in objectsArg.Split(' '))
{
if (!obj.IsEmpty)
{
if (obj.EndsWith(".lib", .OrdinalIgnoreCase))
arCmds.AppendF("ADDLIB {}\n", obj);
else
arCmds.AppendF("ADDMOD {}\n", obj);
}
}
arCmds.AppendF("SAVE\n");