OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # | |
3 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | |
4 # | |
5 # Use of this source code is governed by a BSD-style license | |
6 # that can be found in the LICENSE file in the root of the source | |
7 # tree. An additional intellectual property rights grant can be found | |
8 # in the file PATENTS. All contributing project authors may | |
9 # be found in the AUTHORS file in the root of the source tree. | |
10 | |
11 """Searches for DirectX SDK installation and prints full path to it.""" | |
12 | |
13 import os | |
14 import subprocess | |
15 import sys | |
16 | |
17 | |
18 def main(): | |
19 sys.stdout.write(FindDirectXInstallation()) | |
20 return 0 | |
21 | |
22 | |
23 def FindDirectXInstallation(): | |
24 """Try to find an installation location for the DirectX SDK. Check for the | |
25 standard environment variable, and if that doesn't exist, try to find | |
26 via the registry. Returns empty string if not found in either location.""" | |
27 | |
28 dxsdk_dir = os.environ.get('DXSDK_DIR') | |
29 if dxsdk_dir: | |
30 return dxsdk_dir | |
31 | |
32 # Setup params to pass to and attempt to launch reg.exe. | |
33 cmd = ['reg.exe', 'query', r'HKLM\Software\Microsoft\DirectX', '/s'] | |
34 p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
35 for line in p.communicate()[0].splitlines(): | |
36 if 'InstallPath' in line: | |
37 return line.split(' ')[3] + "\\" | |
38 | |
39 return '' | |
40 | |
41 | |
42 if __name__ == '__main__': | |
43 sys.exit(main()) | |
OLD | NEW |