mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-13 13:54:11 +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,15 +194,43 @@ namespace IDE
|
||||||
|
|
||||||
arCmds.AppendF("CREATE {}\n", targetPath);
|
arCmds.AppendF("CREATE {}\n", targetPath);
|
||||||
|
|
||||||
for (let obj in objectsArg.Split(' '))
|
void AddObject(StringView obj)
|
||||||
{
|
|
||||||
if (!obj.IsEmpty)
|
|
||||||
{
|
{
|
||||||
|
if (obj.IsEmpty)
|
||||||
|
return;
|
||||||
|
|
||||||
if (obj.EndsWith(".lib", .OrdinalIgnoreCase))
|
if (obj.EndsWith(".lib", .OrdinalIgnoreCase))
|
||||||
arCmds.AppendF("ADDLIB {}\n", obj);
|
arCmds.AppendF("ADDLIB {}\n", obj);
|
||||||
else
|
else
|
||||||
arCmds.AppendF("ADDMOD {}\n", obj);
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
arCmds.AppendF("SAVE\n");
|
arCmds.AppendF("SAVE\n");
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,17 @@ namespace IDE
|
||||||
public const char8 cNativeSlash = Path.DirectorySeparatorChar;
|
public const char8 cNativeSlash = Path.DirectorySeparatorChar;
|
||||||
public const char8 cOtherSlash = Path.AltDirectorySeparatorChar;
|
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 hasSpace = srcFileName.Contains(' ');
|
||||||
bool alreadyQuoted = (srcFileName.Length > 0 && srcFileName[0] == '"' && srcFileName[srcFileName.Length - 1] == '"');
|
bool alreadyQuoted = (srcFileName.Length > 0 && srcFileName[0] == '"' && srcFileName[srcFileName.Length - 1] == '"');
|
||||||
|
|
||||||
if (hasSpace && !alreadyQuoted)
|
if (hasSpace && !alreadyQuoted)
|
||||||
targetStr.Append("\"", srcFileName, "\"");
|
{
|
||||||
|
targetStr.Append("\"");
|
||||||
|
targetStr.Append(srcFileName);
|
||||||
|
targetStr.Append("\"");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
targetStr.Append(srcFileName);
|
targetStr.Append(srcFileName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue