MCPcopy Create free account
hub / github.com/beefytech/Beef / GetOldSourceCommand

Method GetOldSourceCommand

IDEHelper/COFF.cpp:6547–6754  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6545}
6546
6547String COFF::GetOldSourceCommand(const StringImpl& path)
6548{
6549 if (mCvSrcSrvStream == -1)
6550 return "";
6551
6552 int outSize;
6553 uint8* data = CvReadStream(mCvSrcSrvStream, &outSize);
6554 String cmdBlock = String((char*)data, outSize);
6555 delete data;
6556
6557 bool inFileSection = false;
6558 Dictionary<String, String> defs;
6559
6560 enum _SectType
6561 {
6562 _SectType_None,
6563 _SectType_Ini,
6564 _SectType_Variables,
6565 _SectType_SourceFiles
6566 };
6567 _SectType sectType = _SectType_None;
6568
6569 //
6570 {
6571 AutoCrit autoCrit(gDebugManager->mCritSect);
6572 defs["TARG"] = gDebugManager->mSymSrvOptions.mSourceServerCacheDir;
6573 }
6574
6575 std::function<void (String&)> _Expand = [&](String& str)
6576 {
6577 for (int i = 0; i < str.length(); i++)
6578 {
6579 if (str[i] == '%')
6580 {
6581 int endIdx = str.IndexOf('%', i + 1);
6582 if (endIdx != -1)
6583 {
6584 String varName = ToUpper(str.Substring(i + 1, endIdx - i - 1));
6585 if (((endIdx < str.length() - 1) && (str[endIdx + 1] == '(')) &&
6586 ((varName == "FNVAR") || (varName == "FNBKSL") || (varName == "FNFILE")))
6587 {
6588 int closePos = str.IndexOf(')', endIdx + 2);
6589 if (closePos != -1)
6590 {
6591 String paramStr = str.Substring(endIdx + 2, closePos - endIdx - 2);
6592 _Expand(paramStr);
6593
6594 if (varName == "FNVAR")
6595 {
6596 paramStr = defs[paramStr];
6597 }
6598 else
6599 {
6600 if (varName == "FNBKSL")
6601 {
6602 paramStr.Replace("/", "\\");
6603 }
6604 else if (varName == "FNFILE")

Callers 1

Calls 15

StringClass · 0.85
StringViewClass · 0.85
SubstringMethod · 0.80
AppendMethod · 0.80
IsWhitespaceMethod · 0.80
BfpFile_GetTempPathFunction · 0.50
lengthMethod · 0.45
IndexOfMethod · 0.45
ReplaceMethod · 0.45
RemoveMethod · 0.45
InsertMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected