[Session restore] Rename group name Enabled to Restore.
[chromium-blink-merge.git] / tools / win / split_link / check_installed.py
blob31bf60f12172e6c6aa7dab8e6d9830816a68140c
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.
5 import os
6 import sys
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.
19 if not _winreg:
20 return False
22 try:
23 val = _winreg.QueryValue(_winreg.HKEY_CURRENT_USER,
24 'Software\\Chromium\\split_link_installed')
25 return os.path.exists(val)
26 except WindowsError:
27 pass
29 return False
32 def main():
33 # Can be called from gyp to set variable.
34 if IsAvailable():
35 sys.stdout.write('1')
36 else:
37 print >> sys.stderr, "Couldn't find split_link installation."
38 print >> sys.stderr, ('Run python tools\\win\\split_link\\'
39 'install_split_link.py from an elevated Visual '
40 'Studio Command Prompt to install.')
41 sys.stdout.write('0')
42 return 1
45 if __name__ == '__main__':
46 sys.exit(main())