Example #1
0
void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper)
{
    if(wrapper.empty())
    {
        return;
    }
    // wrapper可能包含参数(像"gdb --args"). 所以我们不做任何额外的处理, 仅以空格
    // 进行切分.
    StringVector wrapper_argv;
    base::SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv);
    // Prepend the wrapper and update the switches/arguments |begin_args_|.
    argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end());
    begin_args_ += wrapper_argv.size();
}
Example #2
0
	void CommandLine::AppendSwitchNative(const std::string& switch_string,
		const CommandLine::StringType& value) {
			std::string switch_key(LowerASCIIOnWindows(switch_string));
#if defined(OS_WIN)
			StringType combined_switch_string(ASCIIToWide(switch_key));
#elif defined(OS_POSIX)
			StringType combined_switch_string(switch_string);
#endif
			size_t prefix_length = GetSwitchPrefixLength(combined_switch_string);
			switches_[switch_key.substr(prefix_length)] = value;
			// Preserve existing switch prefixes in |argv_|; only append one if necessary.
			if (prefix_length == 0)
				combined_switch_string = kSwitchPrefixes[0] + combined_switch_string;
			if (!value.empty())
				combined_switch_string += kSwitchValueSeparator + value;
			// Append the switch and update the switches/arguments divider |begin_args_|.
			argv_.insert(argv_.begin() + begin_args_++, combined_switch_string);
	}