Chromium Code Reviews| Index: tools/tool_support.cc |
| diff --git a/tools/tool_support.cc b/tools/tool_support.cc |
| index f4960246bb8638c33a292e6cdafff89ee80a34cc..170d4ebc3c5d3591fe62276b4f8ce0b8d0412790 100644 |
| --- a/tools/tool_support.cc |
| +++ b/tools/tool_support.cc |
| @@ -16,7 +16,11 @@ |
| #include <stdio.h> |
| +#include <vector> |
| + |
| #include "package.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/strings/utf_string_conversions.h" |
| namespace crashpad { |
| @@ -67,4 +71,33 @@ void ToolSupport::UsageHint(const std::string& me, const char* hint) { |
| } |
| #endif // OS_POSIX |
| +#if defined(OS_WIN) |
| +// static |
| +int ToolSupport::Wmain(int argc, wchar_t* argv[], int (*entry)(int, char*[])) { |
| + scoped_ptr<char*[]> argv_as_utf8(new char*[argc + 1]); |
| + std::vector<std::string> storage; |
| + storage.reserve(argc); |
| + for (int i = 0; i < argc; ++i) { |
| + storage.push_back(base::UTF16ToUTF8(argv[i])); |
| + argv_as_utf8[i] = &storage[i][0]; |
| + } |
| + argv_as_utf8[argc] = nullptr; |
| + return entry(argc, argv_as_utf8.get()); |
| +} |
| +#endif // OS_WIN |
| + |
| +#if defined(OS_POSIX) |
| +// static |
| +base::FilePath::StringType ToolSupport::UTF8ToFilePathStringType( |
| + const char* path) { |
| + return path; |
|
Mark Mentovai
2015/05/05 22:41:36
The #ifs can go inside the function body for this
scottmg
2015/05/05 23:23:52
Done.
|
| +} |
| +#elif defined(OS_WIN) |
| +// static |
| +base::FilePath::StringType ToolSupport::UTF8ToFilePathStringType( |
| + const char* path) { |
| + return base::UTF8ToUTF16(path); |
| +} |
| +#endif // OS_POSIX |
| + |
| } // namespace crashpad |