OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include <windows.h> | |
6 | |
7 #include "base/at_exit.h" | |
8 #include "base/files/file_path.h" | |
9 #include "base/path_service.h" | |
10 #include "base/version.h" | |
11 #include "chrome/tools/crash_service/caps/exit_codes.h" | |
12 #include "chrome/tools/crash_service/caps/logger_win.h" | |
13 #include "chrome/tools/crash_service/caps/process_singleton_win.h" | |
14 | |
15 int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE prev, wchar_t*, int) { | |
16 base::AtExitManager at_exit_manager; | |
17 base::FilePath dir_exe; | |
18 if (!PathService::Get(base::DIR_EXE, &dir_exe)) | |
19 return caps::EC_INIT_ERROR; | |
20 | |
21 // What directory we write depends if we are being run from the actual | |
22 // location (a versioned directory) or from a build output directory. | |
23 base::Version version(dir_exe.BaseName().MaybeAsASCII()); | |
24 auto data_path = version.IsValid() ? dir_exe.DirName() : dir_exe; | |
25 | |
26 // Start logging. | |
27 caps::Logger logger(data_path); | |
28 | |
29 // Check for an existing running instance. | |
30 caps::ProcessSingleton process_singleton; | |
31 if (process_singleton.other_instance()) | |
32 return caps::EC_EXISTING_INSTANCE; | |
33 | |
34 return caps::EC_NORMAL_EXIT; | |
35 } | |
36 | |
OLD | NEW |