CommandLine::StringType CommandLine::GetArgumentsString() const { StringType params; // Append switches and arguments. bool parse_switches = true; for (size_t i = 1; i < argv_.size(); ++i) { StringType arg = argv_[i]; StringType switch_string; StringType switch_value; parse_switches &= arg != kSwitchTerminator; if (i > 1) params.append(StringType(FILE_PATH_LITERAL(" "))); if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) { params.append(switch_string); if (!switch_value.empty()) { #if defined(OS_WIN) switch_value = QuoteForCommandLineToArgvW(switch_value); #endif params.append(kSwitchValueSeparator + switch_value); } } else { #if defined(OS_WIN) arg = QuoteForCommandLineToArgvW(arg); #endif params.append(arg); } } return params; }
namespace base { #if defined(FILE_PATH_USES_WIN_SEPARATORS) const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("\\/"); #else // FILE_PATH_USES_WIN_SEPARATORS const FilePath::CharType FilePath::kSeparators[] = FILE_PATH_LITERAL("/"); #endif // FILE_PATH_USES_WIN_SEPARATORS const size_t FilePath::kSeparatorsLength = arraysize(kSeparators); const FilePath::CharType FilePath::kCurrentDirectory[] = FILE_PATH_LITERAL("."); const FilePath::CharType FilePath::kParentDirectory[] = FILE_PATH_LITERAL(".."); const FilePath::CharType FilePath::kExtensionSeparator = FILE_PATH_LITERAL('.'); } // namespace base
CommandLine::StringType CommandLine::GetCommandLineString() const { StringType string(argv_[0]); string = QuoteForCommandLineToArgvW(string); // Append switches and arguments. bool parse_switches = true; for(size_t i=1; i<argv_.size(); ++i) { CommandLine::StringType arg = argv_[i]; CommandLine::StringType switch_string; CommandLine::StringType switch_value; parse_switches &= arg != kSwitchTerminator; string.append(StringType(FILE_PATH_LITERAL(" "))); if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) { string.append(switch_string); if(!switch_value.empty()) { switch_value = QuoteForCommandLineToArgvW(switch_value); string.append(kSwitchValueSeparator + switch_value); } } else { arg = QuoteForCommandLineToArgvW(arg); string.append(arg); } } return string; }
void KaminoMainDelegate::PreSandboxStartup(){ base::FilePath pak_file; base::FilePath pak_dir; PathService::Get(base::DIR_MODULE, &pak_dir); pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); }
String blinkRootDir() { base::FilePath path; base::PathService::Get(base::DIR_SOURCE_ROOT, &path); path = path.Append(FILE_PATH_LITERAL("third_party/WebKit")); path = base::MakeAbsoluteFilePath(path); return String::fromUTF8(path.MaybeAsASCII().c_str()); }
CommandLine::StringType CommandLine::GetCommandLineString() const { StringType string(argv_[0]); #if defined(OS_WIN) string = QuoteForCommandLineToArgvW(string); #endif StringType params(GetArgumentsString()); if (!params.empty()) { string.append(StringType(FILE_PATH_LITERAL(" "))); string.append(params); } return string; }
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(); }