void CommandLine::InitFromArgv(int argc, const CommandLine::CharType* const* argv) { StringVector new_argv; for (int i = 0; i < argc; ++i) new_argv.push_back(argv[i]); InitFromArgv(new_argv); }
void CommandLine::ParseFromString(const std::wstring& command_line) { std::wstring command_line_string; //TrimWhitespace(command_line, TRIM_ALL, &command_line_string); command_line_string = command_line; base::trim(command_line_string); if (command_line_string.empty()) return; int num_args = 0; wchar_t** args = NULL; args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args); //DPLOG_IF DBG_IF(ERROR, !args) << "CommandLineToArgvW failed on command line: " << command_line; InitFromArgv(num_args, args); LocalFree(args); }
int main(int argc, char* argv[]) { CefEnableHighDPISupport(); CefMainArgs mainArgs(argc, argv); auto cmdLine = CefCommandLine::CreateCommandLine(); cmdLine->InitFromArgv(argc, argv); std::string configPath = cmdLine->GetSwitchValue("config").ToString(); if (configPath.empty()) { configPath = "config.default.json"; } AppConfig config; if (!LoadAppConfig(configPath.c_str(), &config)) { return -1; } CefRefPtr<CefApp> app(new App(config)); int exitCode = CefExecuteProcess(mainArgs, app, nullptr); if (exitCode >= 0) { return exitCode; } CefSettings settings; settings.no_sandbox = true; settings.remote_debugging_port = 1337; settings.single_process = false; CefString(&settings.cache_path).FromASCII(CACHE_PATH); CefInitialize(mainArgs, settings, app, nullptr); CefRunMessageLoop(); CefShutdown(); return 0; }
CommandLine::CommandLine(const StringVector& argv) : argv_(1), begin_args_(1) { InitFromArgv(argv); }
CommandLine::CommandLine(int argc, const CommandLine::CharType* const* argv) : argv_(1), begin_args_(1) { InitFromArgv(argc, argv); }