tvo / rapid

Commandline client for Spring rapid downloading system
Other
7 stars 6 forks source link

rapid prefers C:\Program Files\Spring\unitsync.dll over ..\unitsync.dll #26

Closed abma closed 13 years ago

abma commented 13 years ago

when spring is installed twice: stable in C:\Program Files\Spring\unitsync.dll and c:\temp\spring

and c:\temp\spring\rapid\rapid.exe is run, the unitsync in program files is used.

abma commented 13 years ago

best would be, to support the newly registry-key, but i'm unsure if that makes sense/is possible in python.

(HKLM\Software\Spring\SpringEngineHelper points directly to unitsync)

tvo commented 13 years ago

Should be possible, I suppose I can add that to the searched locations.

For the regkey-not-present case I can swap the order in which Program Files and . and .. are searched.

abma commented 13 years ago

so.. imo order should be (mostly because of portable installs):

current path parent path reg key (if still needed? program files)

i hope i didn't miss something

tvo commented 13 years ago

Here you can see where it looks and in which order:

https://github.com/tvo/rapid/blob/master/rapid/unitsync/api.py#L30

On 1 April 2011 12:03, abma reply@reply.github.com wrote:

so.. imo order should be (mostly because of portable installs):

current path parent path reg key

(i hope i didn't miss something)

Reply to this email directly or view it on GitHub: https://github.com/tvo/rapid/issues/26#comment_944943

tvo commented 13 years ago

Maybe you can try this code at some point and see what it prints:

import os
if os.name == 'nt':
    import _winreg
    try:
        key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r'Software\Spring')
        value, type = _winreg.QueryValueEx(key, r'SpringEngineHelper')
        _winreg.CloseKey(key)
        if type == _winreg.REG_SZ:
            print value
        else:
            print 'key of unknown type'
    except _winreg.WindowsError as e:
        print e
abma commented 13 years ago

seems to work: prints c:\programme\spring\unitsync.dll

if the key doesn't exist i get:

AttributeError: module object has no attribute 'WindowsError'

when modified except _winreg.WindowsError as e to except WindowsError as e:

it prints "The System cannot find the specified File"

tvo commented 13 years ago

Great, thanks!

I will integrate this asap.

On 7 April 2011 17:43, abma reply@reply.github.com wrote:

seems to work: prints c:\programme\spring\unitsync.dll

if the key doesn't exist i get:

AttributeError: module object has no attribute 'WindowsError'

when modified except _winreg.WindowsError as e to except WindowsError as e:

it prints "The System cannot find the specified File"

Reply to this email directly or view it on GitHub: https://github.com/tvo/rapid/issues/26#comment_969488

tvo commented 13 years ago

Thanks for integrating it!