39 # 2. create start menu entry and shortcuts |
39 # 2. create start menu entry and shortcuts |
40 regName = "Programs" |
40 regName = "Programs" |
41 programsEntry = getWinregEntry(regName, regPath) |
41 programsEntry = getWinregEntry(regName, regPath) |
42 if programsEntry: |
42 if programsEntry: |
43 programsFolder = os.path.normpath(os.path.expandvars(programsEntry)) |
43 programsFolder = os.path.normpath(os.path.expandvars(programsEntry)) |
44 eric6EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
44 eric7EntryPath = os.path.join(programsFolder, windowsProgramsEntry()) |
45 if not os.path.exists(eric6EntryPath): |
45 if not os.path.exists(eric7EntryPath): |
46 try: |
46 try: |
47 os.makedirs(eric6EntryPath) |
47 os.makedirs(eric7EntryPath) |
48 except OSError: |
48 except OSError: |
49 # maybe restrictions prohibited link creation |
49 # maybe restrictions prohibited link creation |
50 return |
50 return |
51 |
51 |
52 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
52 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
53 linkPath = os.path.join(eric6EntryPath, linkName) |
53 linkPath = os.path.join(eric7EntryPath, linkName) |
54 createWindowsShortcut(linkPath, targetPath, iconPath) |
54 createWindowsShortcut(linkPath, targetPath, iconPath) |
55 |
55 |
56 |
56 |
57 def getWinregEntry(name, path): |
57 def getWinregEntry(name, path): |
58 """ |
58 """ |
121 the link target and the icon target |
121 the link target and the icon target |
122 @rtype list of tuples of (str, str, str) |
122 @rtype list of tuples of (str, str, str) |
123 """ |
123 """ |
124 majorVersion, minorVersion = sys.version_info[:2] |
124 majorVersion, minorVersion = sys.version_info[:2] |
125 entriesTemplates = [ |
125 entriesTemplates = [ |
126 ("eric6 (Python {0}.{1}).lnk", |
126 ("eric7 (Python {0}.{1}).lnk", |
127 os.path.join(getConfig("bindir"), "eric6.cmd"), |
127 os.path.join(getConfig("bindir"), "eric7.cmd"), |
128 os.path.join(getConfig("ericPixDir"), "eric6.ico")), |
128 os.path.join(getConfig("ericPixDir"), "eric7.ico")), |
129 ("eric6 Browser (Python {0}.{1}).lnk", |
129 ("eric7 Browser (Python {0}.{1}).lnk", |
130 os.path.join(getConfig("bindir"), "eric6_browser.cmd"), |
130 os.path.join(getConfig("bindir"), "eric7_browser.cmd"), |
131 os.path.join(getConfig("ericPixDir"), "ericWeb48.ico")), |
131 os.path.join(getConfig("ericPixDir"), "ericWeb48.ico")), |
132 ] |
132 ] |
133 |
133 |
134 return [ |
134 return [ |
135 (e[0].format(majorVersion, minorVersion), e[1], e[2]) |
135 (e[0].format(majorVersion, minorVersion), e[1], e[2]) |
143 |
143 |
144 @return name of the Start Menu top entry |
144 @return name of the Start Menu top entry |
145 @rtype str |
145 @rtype str |
146 """ |
146 """ |
147 majorVersion, minorVersion = sys.version_info[:2] |
147 majorVersion, minorVersion = sys.version_info[:2] |
148 return "eric6 (Python {0}.{1})".format(majorVersion, minorVersion) |
148 return "eric7 (Python {0}.{1})".format(majorVersion, minorVersion) |
149 |
149 |
150 |
150 |
151 if __name__ == "__main__": |
151 if __name__ == "__main__": |
152 try: |
152 try: |
153 main(sys.argv) |
153 main(sys.argv) |