()
return dxsdk_dir
Try to find an installation location for the DirectX SDK. Check for the
    standard environment variable, and if that doesn't exist, try to find
    via the registry. May return None if not found in either location.
Try to find an installation location for the DirectX SDK. Check for the
    standard environment variable, and if that doesn't exist, try to find
    via the registry. May return None if not found in either location.
Try to find an installation location for the DirectX SDK . Check for the standard environment variable and if that doesn t exist try to find via the registry . May return None if not found in either location .
def _FindDirectXInstallation():
    """Try to find an installation location for the DirectX SDK. Check for the
    standard environment variable, and if that doesn't exist, try to find
    via the registry. May return None if not found in either location."""
    # Return previously calculated value, if there is one
    if hasattr(_FindDirectXInstallation, "dxsdk_dir"):
        return _FindDirectXInstallation.dxsdk_dir

    dxsdk_dir = os.environ.get("DXSDK_DIR")
    if not dxsdk_dir:
        # Setup params to pass to and attempt to launch reg.exe.
        cmd = ["reg.exe", "query", r"HKLM\Software\Microsoft\DirectX", "/s"]
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout = p.communicate()[0].decode("utf-8")
        for line in stdout.splitlines():
            if "InstallPath" in line:
                dxsdk_dir = line.split("    ")[3] + "\\"

    # Cache return value
    _FindDirectXInstallation.dxsdk_dir = dxsdk_dir
    return dxsdk_dir
def _FindDirectXInstallation ( ) : # Return previously calculated value, if there is one if hasattr ( _FindDirectXInstallation , "dxsdk_dir" ) : return _FindDirectXInstallation . dxsdk_dir dxsdk_dir = os . environ . get ( "DXSDK_DIR" ) if not dxsdk_dir : # Setup params to pass to and attempt to launch reg.exe. cmd = [ "reg.exe" , "query" , r"HKLM\Software\Microsoft\DirectX" , "/s" ] p = subprocess . Popen ( cmd , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) stdout = p . communicate ( ) [ 0 ] . decode ( "utf-8" ) for line in stdout . splitlines ( ) : if "InstallPath" in line : dxsdk_dir = line . split ( "    " ) [ 3 ] + "\\" # Cache return value _FindDirectXInstallation . dxsdk_dir = dxsdk_dir return dxsdk_dir