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

Function BfpSystem_SetCommandLine

BeefySysLib/platform/posix/PosixCommon.cpp:589–621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589BFP_EXPORT void BFP_CALLTYPE BfpSystem_SetCommandLine(int argc, char** argv)
590{
591 char exePath[PATH_MAX] = { 0 };
592 int nchar = readlink("/proc/self/exe", exePath, PATH_MAX);
593 if (nchar > 0)
594 {
595 gExePath = exePath;
596 }
597 else
598 {
599 char* relPath = argv[0];
600 char* cwd = getcwd(NULL, 0);
601 gExePath = GetAbsPath(relPath, cwd);
602 free(cwd);
603 }
604
605 for (int i = 0; i < argc; i++)
606 {
607 if (i != 0)
608 gCmdLine.Append(' ');
609
610 String arg = argv[i];
611 if (arg.IsEmpty() || arg.Contains(' ') || arg.Contains('\t') || arg.Contains('\r') || arg.Contains('\n') || arg.Contains('\"'))
612 {
613 arg.Replace("\"", "\\\"");
614 gCmdLine.Append("\"");
615 gCmdLine.Append(arg);
616 gCmdLine.Append("\"");
617 }
618 else
619 gCmdLine.Append(arg);
620 }
621}
622
623
624BFP_EXPORT void BFP_CALLTYPE BfpSystem_SetCrashReportKind(BfpCrashReportKind crashReportKind)

Callers

nothing calls this directly

Calls 6

AppendMethod · 0.80
getcwdFunction · 0.50
freeFunction · 0.50
IsEmptyMethod · 0.45
ContainsMethod · 0.45
ReplaceMethod · 0.45

Tested by

no test coverage detected