| 5 | #include "Engine/Platform/StringUtils.h" |
| 6 | |
| 7 | const 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 | } |