| 3136 | // Create a Windows program group folder containing icons for Astrolog. |
| 3137 | |
| 3138 | flag FCreateProgramGroup(flag fAll) |
| 3139 | { |
| 3140 | char szDir[cchSzMax], szName[cchSzMax], *pch; |
| 3141 | LPITEMIDLIST pidl; |
| 3142 | |
| 3143 | // Create program group folder. |
| 3144 | SHGetSpecialFolderLocation(wi.hwnd, |
| 3145 | fAll ? CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &pidl); |
| 3146 | SHGetPathFromIDList(pidl, szDir); |
| 3147 | for (pch = szDir; *pch; pch++) |
| 3148 | ; |
| 3149 | sprintf(pch, "\\Astrolog"); |
| 3150 | if (!CreateDirectory(szDir, NULL)) { |
| 3151 | if (GetLastError() != ERROR_ALREADY_EXISTS) |
| 3152 | goto LError; |
| 3153 | } |
| 3154 | |
| 3155 | // Delete old previous version shortcuts from folder. |
| 3156 | DeleteShortcut(szDir, "Astrolog 6.00"); |
| 3157 | DeleteShortcut(szDir, "Astrolog 6.10"); |
| 3158 | DeleteShortcut(szDir, "Astrolog 6.20"); |
| 3159 | DeleteShortcut(szDir, "Astrolog 6.30"); |
| 3160 | DeleteShortcut(szDir, "Astrolog 6.40"); |
| 3161 | DeleteShortcut(szDir, "Astrolog 6.50"); |
| 3162 | DeleteShortcut(szDir, "Astrolog 7.00"); |
| 3163 | DeleteShortcut(szDir, "Astrolog 7.10"); |
| 3164 | DeleteShortcut(szDir, "Astrolog 7.20"); |
| 3165 | DeleteShortcut(szDir, "Astrolog 7.30"); |
| 3166 | DeleteShortcut(szDir, "Astrolog 7.40"); |
| 3167 | DeleteShortcut(szDir, "Astrolog 7.50"); |
| 3168 | DeleteShortcut(szDir, "Astrolog 7.60"); |
| 3169 | DeleteShortcut(szDir, "Astrolog 7.70"); |
| 3170 | DeleteShortcut(szDir, "Astrolog 7.80"); |
| 3171 | |
| 3172 | // Add main shortcuts in folder. |
| 3173 | sprintf(szName, "%s %s", szAppName, szVersionCore); |
| 3174 | if (!FCreateShortcut(szDir, szName, |
| 3175 | "astrolog.exe", "Astrolog executable", -1)) |
| 3176 | goto LError; |
| 3177 | if (!FCreateShortcut(szDir, "Astrolog documentation", |
| 3178 | "astrolog.htm", NULL, -1)) |
| 3179 | goto LError; |
| 3180 | if (!FCreateShortcut(szDir, "Astrolog changes", "changes.htm", NULL, -1)) |
| 3181 | goto LError; |
| 3182 | if (!FCreateShortcut(szDir, "Astrolog website", "astrolog.url", NULL, 3)) |
| 3183 | goto LError; |
| 3184 | |
| 3185 | return fTrue; |
| 3186 | LError: |
| 3187 | PrintError("Failed to create program group.\n" |
| 3188 | "Astrolog can still be run from other icons or directly from its folder."); |
| 3189 | return fFalse; |
| 3190 | } |
| 3191 | |
| 3192 | |
| 3193 | // Add info about Astrolog specific file extensions to the Windows registry. |
no test coverage detected