Created
January 22, 2017 20:31
-
-
Save TTimo/c221a1cae22a78370918f39e9d828d39 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: This rewrites the entry every time | |
logging.info( 'Associate build in the registry...' ) | |
engine_path = os.path.abspath( os.path.join( os.getcwd(), LOCAL_FOLDER ) ) | |
engine_path_normed = os.path.normcase( os.path.normpath( engine_path ) ) | |
logging.info( engine_path ) | |
# open or create | |
key = _winreg.CreateKeyEx( _winreg.HKEY_CURRENT_USER, r"Software\Epic Games\Unreal Engine\Builds", 0, _winreg.KEY_ALL_ACCESS ) | |
i = 0 | |
while ( True ): | |
try: | |
( name, value, value_type ) = _winreg.EnumValue( key, i ) | |
except WindowsError: | |
break | |
logging.info( pprint.pformat( ( name, value, value_type ) ) ) | |
# 'samefile' is not available on Windows | |
if ( os.path.normcase( os.path.normpath( value ) ) == engine_path_normed ): | |
logging.info( 'Delete entry %s' % name ) | |
_winreg.DeleteValue( key, name ) | |
else: | |
i += 1 | |
logging.info( 'Link the build in the registry' ) | |
_winreg.SetValueEx( key, BUILD_GUID, 0, 1, engine_path ) | |
_winreg.CloseKey( key ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment