void ezInputManager::RetrieveAllKnownInputSlots(ezDynamicArray<const char*>& out_InputSlots) { out_InputSlots.Clear(); out_InputSlots.Reserve(GetInternals().s_InputSlots.GetCount()); // just copy all slot names into the given array for (ezInputSlotsMap::Iterator it = GetInternals().s_InputSlots.GetIterator(); it.IsValid(); it.Next()) { out_InputSlots.PushBack(it.Key().GetData()); } }
void ezCommandLineUtils::SplitCommandLineString(const char* commandString, bool addExecutableDir, ezDynamicArray<ezString>& outArgs, ezDynamicArray<const char*>& outArgsV) { // Add application dir as first argument as customary on other platforms. if (addExecutableDir) { #if EZ_ENABLED(EZ_PLATFORM_WINDOWS) wchar_t moduleFilename[256]; GetModuleFileNameW(nullptr, moduleFilename, 256); outArgs.PushBack(ezStringUtf8(moduleFilename).GetData()); #else EZ_ASSERT_NOT_IMPLEMENTED; #endif } // Simple args splitting. Not as powerful as Win32's CommandLineToArgvW. const char* currentChar = commandString; const char* lastEnd = currentChar; bool inQuotes = false; while (*currentChar != '\0') { if (*currentChar == '\"') inQuotes = !inQuotes; else if (*currentChar == ' ' && !inQuotes) { ezStringBuilder path = ezStringView(lastEnd, currentChar); path.Trim(" \""); outArgs.PushBack(path); lastEnd = currentChar + 1; } ezUnicodeUtils::MoveToNextUtf8(currentChar); } outArgsV.Reserve(outArgsV.GetCount()); for (ezString& str : outArgs) outArgsV.PushBack(str.GetData()); }