OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 switches_.find(lowercased_switch); | 325 switches_.find(lowercased_switch); |
326 | 326 |
327 if (result == switches_.end()) { | 327 if (result == switches_.end()) { |
328 return CommandLine::StringType(); | 328 return CommandLine::StringType(); |
329 } else { | 329 } else { |
330 return result->second; | 330 return result->second; |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
334 FilePath CommandLine::GetProgram() const { | 334 FilePath CommandLine::GetProgram() const { |
335 return FilePath::FromWStringHack(program()); | 335 #if defined(OS_WIN) |
| 336 return FilePath(program_); |
| 337 #else |
| 338 DCHECK_GT(argv_.size(), 0U); |
| 339 return FilePath(argv_[0]); |
| 340 #endif |
336 } | 341 } |
337 | 342 |
338 #if defined(OS_WIN) | 343 #if defined(OS_WIN) |
339 std::wstring CommandLine::program() const { | 344 std::wstring CommandLine::program() const { |
340 return program_; | 345 return program_; |
341 } | 346 } |
342 #else | |
343 std::wstring CommandLine::program() const { | |
344 DCHECK_GT(argv_.size(), 0U); | |
345 return base::SysNativeMBToWide(argv_[0]); | |
346 } | |
347 #endif | 347 #endif |
348 | 348 |
349 #if defined(OS_POSIX) | 349 #if defined(OS_POSIX) |
350 std::string CommandLine::command_line_string() const { | 350 std::string CommandLine::command_line_string() const { |
351 return JoinString(argv_, ' '); | 351 return JoinString(argv_, ' '); |
352 } | 352 } |
353 #endif | 353 #endif |
354 | 354 |
355 #if defined(OS_WIN) | 355 #if defined(OS_WIN) |
356 void CommandLine::AppendSwitch(const std::string& switch_string) { | 356 void CommandLine::AppendSwitch(const std::string& switch_string) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 | 528 |
529 // private | 529 // private |
530 CommandLine::CommandLine() { | 530 CommandLine::CommandLine() { |
531 } | 531 } |
532 | 532 |
533 // static | 533 // static |
534 CommandLine* CommandLine::ForCurrentProcessMutable() { | 534 CommandLine* CommandLine::ForCurrentProcessMutable() { |
535 DCHECK(current_process_commandline_); | 535 DCHECK(current_process_commandline_); |
536 return current_process_commandline_; | 536 return current_process_commandline_; |
537 } | 537 } |
OLD | NEW |