mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed static lib archiving with paths with spaces
This commit is contained in:
parent
97a828a12a
commit
23dafd4e6d
2 changed files with 38 additions and 6 deletions
|
@ -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");
|
||||
|
|
|
@ -17,13 +17,17 @@ namespace IDE
|
|||
public const char8 cNativeSlash = Path.DirectorySeparatorChar;
|
||||
public const char8 cOtherSlash = Path.AltDirectorySeparatorChar;
|
||||
|
||||
public static void AppendWithOptionalQuotes(String targetStr, String srcFileName)
|
||||
public static void AppendWithOptionalQuotes(String targetStr, StringView srcFileName)
|
||||
{
|
||||
bool hasSpace = srcFileName.Contains(' ');
|
||||
bool alreadyQuoted = (srcFileName.Length > 0 && srcFileName[0] == '"' && srcFileName[srcFileName.Length - 1] == '"');
|
||||
|
||||
if (hasSpace && !alreadyQuoted)
|
||||
targetStr.Append("\"", srcFileName, "\"");
|
||||
{
|
||||
targetStr.Append("\"");
|
||||
targetStr.Append(srcFileName);
|
||||
targetStr.Append("\"");
|
||||
}
|
||||
else
|
||||
targetStr.Append(srcFileName);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue