Changeset 4234 for trunk/makeBat.py


Ignore:
Timestamp:
Jan 3, 2020 5:09:46 PM (22 months ago)
Author:
toby
Message:

Cleanup registry stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/makeBat.py

    r4230 r4234  
    5757    G2icon = os.path.join(gsaspath,'gsas2.ico')
    5858    pythonexe = os.path.realpath(sys.executable)
     59    print('Python installed at',pythonexe)
     60    print('GSAS-II installed at',gsaspath)
    5961    # Bob reports a problem using pythonw.exe w/Canopy on Windows, so change that if used
    6062    if pythonexe.lower().endswith('pythonw.exe'):
     
    9597    # this code does not appear to work properly when paths have spaces
    9698    try:
    97         oldgpx = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\GSAS-II.project')
     99        oldgpx = winreg.OpenKey(winreg.HKEY_CURRENT_USER,r'Software\CLASSES\GSAS-II.project') # throws FileNotFoundError
    98100        oldopen = winreg.OpenKey(oldgpx,r'shell\open\command')
    99         oldBat = winreg.QueryValue(oldopen,None).split()[0]
     101        # get previous value & strip %1 off end
     102        oldBat = winreg.QueryValue(oldopen,None).strip()
     103        pos = oldBat.rfind(' ')
     104        if pos > 1:
     105            oldBat = oldBat[:pos]
    100106        os.stat(oldBat)     #check if it is still around
    101107    except FileNotFoundError:
    102108        if oldBat:
    103             print('old '+oldBat+ 'not found; registry entry will be made for new one')
    104         else:
    105             new = True
     109            print('old GPX assignment',oldBat, 'not found; registry entry will be made for new one')
     110        new = True
    106111    if not new:
    107112        try:
Note: See TracChangeset for help on using the changeset viewer.