OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2013 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 import os | |
6 import sys | |
7 | |
8 | |
9 def IsAvailable(): | |
10 _winreg = None | |
11 if sys.platform == 'win32': | |
12 import _winreg | |
13 elif sys.platform == 'cygwin': | |
14 try: | |
15 import cygwinreg as _winreg | |
16 except ImportError: | |
17 pass # If not available, be safe and write 0. | |
18 | |
19 if not _winreg: | |
20 return False | |
21 | |
22 try: | |
23 val = _winreg.QueryValue(_winreg.HKEY_CURRENT_USER, | |
24 'Software\\Chromium\\split_link_installed') | |
25 if os.path.exists(val): | |
M-A Ruel
2013/05/14 00:39:09
return os.path.exists(val)
works just fine.
scottmg
2013/05/14 03:35:07
Done.
| |
26 return True | |
27 except WindowsError: | |
28 pass | |
29 | |
30 return False | |
31 | |
32 | |
33 def main(): | |
34 # Can be called from gyp to set variable. | |
35 if IsAvailable(): | |
36 sys.stdout.write('1') | |
37 else: | |
38 print >>sys.stderr, "Couldn't find split_link installation." | |
39 print >>sys.stderr, ('Run python tools\\win\\split_link\\' | |
40 'install_split_link.py from an elevated Visual ' | |
41 'Studio Command Prompt to install.') | |
42 sys.stdout.write('0') | |
43 return 1 | |
44 | |
45 | |
46 if __name__ == '__main__': | |
47 sys.exit(main()) | |
OLD | NEW |