OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 # Copyright 2015 The Crashpad Authors. All rights reserved. |
| 4 # |
| 5 # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 # you may not use this file except in compliance with the License. |
| 7 # You may obtain a copy of the License at |
| 8 # |
| 9 # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 # |
| 11 # Unless required by applicable law or agreed to in writing, software |
| 12 # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 # See the License for the specific language governing permissions and |
| 15 # limitations under the License. |
| 16 |
| 17 import os |
| 18 import sys |
| 19 |
| 20 |
| 21 def FindInstalledWindowsApplication(app_path): |
| 22 search_paths = [os.getenv('PROGRAMFILES(X86)'), |
| 23 os.getenv('PROGRAMFILES'), |
| 24 os.getenv('LOCALAPPDATA')] |
| 25 search_paths += os.getenv('PATH', '').split(os.pathsep) |
| 26 |
| 27 for search_path in search_paths: |
| 28 if not search_path: |
| 29 continue |
| 30 path = os.path.join(search_path, app_path) |
| 31 if os.path.isfile(path): |
| 32 return path |
| 33 |
| 34 return None |
| 35 |
| 36 |
| 37 def GetCdbPath(): |
| 38 possible_paths = ( |
| 39 os.path.join('Windows Kits', '10', 'Debuggers', 'x64'), |
| 40 os.path.join('Windows Kits', '10', 'Debuggers', 'x86'), |
| 41 os.path.join('Windows Kits', '8.1', 'Debuggers', 'x64'), |
| 42 os.path.join('Windows Kits', '8.1', 'Debuggers', 'x86'), |
| 43 os.path.join('Windows Kits', '8.0', 'Debuggers', 'x64'), |
| 44 os.path.join('Windows Kits', '8.0', 'Debuggers', 'x86'), |
| 45 'Debugging Tools For Windows (x64)', |
| 46 'Debugging Tools For Windows (x86)', |
| 47 'Debugging Tools For Windows', |
| 48 os.path.join('win_toolchain', 'vs2013_files', 'win8sdk', 'Debuggers', |
| 49 'x64'), |
| 50 os.path.join('win_toolchain', 'vs2013_files', 'win8sdk', 'Debuggers', |
| 51 'x86'), |
| 52 ) |
| 53 for possible_path in possible_paths: |
| 54 app_path = os.path.join(possible_path, 'cdb.exe') |
| 55 app_path = FindInstalledWindowsApplication(app_path) |
| 56 if app_path: |
| 57 return app_path |
| 58 return None |
| 59 |
| 60 |
| 61 def main(args): |
| 62 cdb_path = GetCdbPath() |
| 63 print 'cdb_path:', cdb_path |
| 64 return 0 |
| 65 |
| 66 |
| 67 if __name__ == '__main__': |
| 68 sys.exit(main(sys.argv[1:])) |
OLD | NEW |