parameters: (ctx, version)
return_statement: return vs_tools_path
docstring: Attempt to locate the installed visual studio VC path
      :param version: Visual studio version (12.0, 14.0, etc)
      :param fallback_path: In case the registry key cannot be found, fall back and see if this path exists
      :return: The path to use for the visual studio VC folder
docstring_summary: Attempt to locate the installed visual studio VC path
      :param version: Visual studio version (12.0, 14.0, etc)
      :param fallback_path: In case the registry key cannot be found, fall back and see if this path exists
      :return: The path to use for the visual studio VC folder
docstring_tokens: Attempt to locate the installed visual studio VC path : param version : Visual studio version ( 12 . 0 14 . 0 etc ) : param fallback_path : In case the registry key cannot be found fall back and see if this path exists : return : The path to use for the visual studio VC folder
function: def detect_visual_studio_vc_path(ctx, version):
      """
      Attempt to locate the installed visual studio VC path
      :param version: Visual studio version (12.0, 14.0, etc)
      :param fallback_path: In case the registry key cannot be found, fall back and see if this path exists
      :return: The path to use for the visual studio VC folder
      """
      if not winreg_available:
          raise SystemError('[ERR] Windows registry is not supported on this platform.')
  
      cache_key = 'detect_visual_studio_vc_path_{}'.format(version)
      if cache_key in cached_folders:
          return cached_folders[cache_key]
  
      vs_tools_path = os.path.normpath('C:\\Program Files (x86)\\Microsoft Visual Studio ' + version + '\\VC')
      if not os.path.isdir(vs_tools_path):
          vs_tools_path = ''
  
      try:
          vs_regkey = 'Software\\Microsoft\\VisualStudio\\{}_Config\\Setup\\vs'.format(version)
          vs_tools_reg_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, vs_regkey, 0, winreg.KEY_READ)
          (vs_tools_path, reg_type) = winreg.QueryValueEx(vs_tools_reg_key, 'ProductDir')
          vs_tools_path = vs_tools_path.encode('ascii')  # Make ascii string (as we get unicode)
          vs_tools_path += 'VC'
      except:
          Logs.warn('[WARN] Unable to find visual studio tools path from the registry.')
  
      if vs_tools_path == '':
          raise SystemError('[ERR] Unable to locate the visual studio VC folder for (vs version {})'.format(version))
  
      if not os.path.isdir(vs_tools_path):
          raise SystemError('[ERR] Unable to locate the visual studio VC folder {} for (vs version {})'.format(vs_tools_path, version))
  
      cached_folders[cache_key] = vs_tools_path
      return vs_tools_path
function_tokens: def detect_visual_studio_vc_path ( ctx , version ) : if not winreg_available : raise SystemError ( '[ERR] Windows registry is not supported on this platform.' ) cache_key = 'detect_visual_studio_vc_path_{}' . format ( version ) if cache_key in cached_folders : return cached_folders [ cache_key ] vs_tools_path = os . path . normpath ( 'C:\\Program Files (x86)\\Microsoft Visual Studio ' + version + '\\VC' ) if not os . path . isdir ( vs_tools_path ) : vs_tools_path = '' try : vs_regkey = 'Software\\Microsoft\\VisualStudio\\{}_Config\\Setup\\vs' . format ( version ) vs_tools_reg_key = winreg . OpenKey ( winreg . HKEY_CURRENT_USER , vs_regkey , 0 , winreg . KEY_READ ) ( vs_tools_path , reg_type ) = winreg . QueryValueEx ( vs_tools_reg_key , 'ProductDir' ) vs_tools_path = vs_tools_path . encode ( 'ascii' ) # Make ascii string (as we get unicode) vs_tools_path += 'VC' except : Logs . warn ( '[WARN] Unable to find visual studio tools path from the registry.' ) if vs_tools_path == '' : raise SystemError ( '[ERR] Unable to locate the visual studio VC folder for (vs version {})' . format ( version ) ) if not os . path . isdir ( vs_tools_path ) : raise SystemError ( '[ERR] Unable to locate the visual studio VC folder {} for (vs version {})' . format ( vs_tools_path , version ) ) cached_folders [ cache_key ] = vs_tools_path return vs_tools_path