MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetCommandLine

Function GetCommandLine

Source/Engine/Main/MainUtil.h:7–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "Engine/Platform/StringUtils.h"
6
7const Char* GetCommandLine(int argc, char* argv[])
8{
9 int32 length = 0;
10 for (int i = 1; argc > 1 && i < argc; i++)
11 {
12 length += StringUtils::Length((const char*)argv[i]);
13 if (i + 1 != argc)
14 length++;
15 }
16 const Char* cmdLine;
17 if (length != 0)
18 {
19 Char* str = (Char*)malloc((length + 1) * sizeof(Char));
20 cmdLine = str;
21 for (int i = 1; i < argc; i++)
22 {
23 length = StringUtils::Length((const char*)argv[i]);
24 int32 strLen = 0;
25 StringUtils::ConvertANSI2UTF16(argv[i], str, length, strLen);
26 str += strLen;
27 if (i + 1 != argc)
28 *str++ = TEXT(' ');
29 }
30 *str = TEXT('\0');
31 }
32 else
33 {
34 cmdLine = TEXT("");
35 }
36 return cmdLine;
37}

Callers 1

mainFunction · 0.85

Calls 1

LengthFunction · 0.50

Tested by

no test coverage detected