Mercurial > hg > xemacs-beta
comparison netinstall/desktop.cc @ 666:146d342ff859
[xemacs-hg @ 2001-09-25 02:35:32 by andyp]
more updates
author | andyp |
---|---|
date | Tue, 25 Sep 2001 02:35:32 +0000 |
parents | ce0b3f2eff35 |
children | 42a8626b741e |
comparison
equal
deleted
inserted
replaced
665:fdefd0186b75 | 666:146d342ff859 |
---|---|
59 #define COMMAND9XARGS "/E:4096 /c" | 59 #define COMMAND9XARGS "/E:4096 /c" |
60 #define COMMAND9XEXE "\\command.com" | 60 #define COMMAND9XEXE "\\command.com" |
61 | 61 |
62 static char *iconname; | 62 static char *iconname; |
63 static char *batname; | 63 static char *batname; |
64 | 64 static char *uninstname; |
65 static void | 65 |
66 make_link (char *linkpath, char *title, char *target) | 66 static void |
67 { | 67 make_link (char *linkpath, char *title, char *target, char* args) |
68 { | |
69 #if 0 | |
68 char argbuf[_MAX_PATH]; | 70 char argbuf[_MAX_PATH]; |
71 #endif | |
69 char *fname = concat (linkpath, "/", title, ".lnk", 0); | 72 char *fname = concat (linkpath, "/", title, ".lnk", 0); |
70 | 73 |
71 if (_access (fname, 0) == 0) | 74 if (_access (fname, 0) == 0) |
72 return; /* already exists */ | 75 return; /* already exists */ |
73 | 76 |
74 msg ("make_link %s, %s, %s\n", fname, title, target); | 77 msg ("make_link %s, %s, %s, %s\n", fname, title, target, args); |
75 | 78 |
76 mkdir_p (0, fname); | 79 mkdir_p (0, fname); |
77 | 80 |
78 char *exepath, *args; | 81 char *exepath; |
79 | 82 #if 0 |
80 /* If we are running Win9x, build a command line. */ | 83 /* If we are running Win9x, build a command line. */ |
81 if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) | 84 if (verinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) |
82 { | 85 { |
86 #endif | |
83 exepath = target; | 87 exepath = target; |
84 args = ""; | 88 #if 0 |
85 } | 89 } |
86 else | 90 else |
87 { | 91 { |
88 char windir[MAX_PATH]; | 92 char windir[MAX_PATH]; |
89 | 93 |
90 GetWindowsDirectory (windir, sizeof (windir)); | 94 GetWindowsDirectory (windir, sizeof (windir)); |
91 exepath = concat (windir, COMMAND9XEXE, 0); | 95 exepath = concat (windir, COMMAND9XEXE, 0); |
92 sprintf (argbuf, "%s %s", COMMAND9XARGS, target); | 96 sprintf (argbuf, "%s %s", COMMAND9XARGS, target); |
93 args = argbuf; | 97 args = argbuf; |
94 } | 98 } |
95 | 99 #endif |
96 msg ("make_link_2 (%s, %s, %s, %s)", exepath, args, iconname, fname); | 100 msg ("make_link_2 (%s, %s, %s, %s)", exepath, args, iconname, fname); |
97 make_link_2 (exepath, args, iconname, fname); | 101 make_link_2 (backslash (exepath), args, iconname, fname); |
98 } | 102 } |
99 | 103 |
100 static char* | 104 static char* |
101 find_xemacs_exe_path () | 105 find_xemacs_exe_path () |
102 { | 106 { |
106 return backslash (concat (root_dir, "\\XEmacs-", | 110 return backslash (concat (root_dir, "\\XEmacs-", |
107 xemacs_package->info[xemacs_package->trust].version, | 111 xemacs_package->info[xemacs_package->trust].version, |
108 "\\", XEMACS_NATIVE_ARCH_NAME, 0)); | 112 "\\", XEMACS_NATIVE_ARCH_NAME, 0)); |
109 } | 113 } |
110 | 114 |
111 static char* | 115 char* |
112 find_xemacs_exe_name () | 116 find_xemacs_exe_name () |
113 { | 117 { |
114 /* Hack to support older versions. */ | 118 /* Hack to support older versions. */ |
115 if (strncmp (xemacs_package->info[xemacs_package->trust].version, | 119 if (strncmp (xemacs_package->info[xemacs_package->trust].version, |
116 "21.1", 4) == 0) | 120 "21.1", 4) == 0) |
124 } | 128 } |
125 | 129 |
126 static void | 130 static void |
127 remove_link (char *linkpath, char* title) | 131 remove_link (char *linkpath, char* title) |
128 { | 132 { |
129 char *fname = concat (linkpath, "/", title, ".lnk", 0); | 133 if (title) |
130 | 134 { |
131 if (_access (fname, 0) != 0) | 135 char *fname = backslash (concat (linkpath, "/", title, ".lnk", 0)); |
132 return; /* doesn't exist */ | 136 msg ("remove_link %s, %s\n", fname, title); |
133 | 137 if (_access (fname, 0) != 0) |
134 msg ("remove_link %s, %s, %s\n", fname, title); | 138 return; /* doesn't exist */ |
135 _unlink (fname); | 139 _unlink (fname); |
136 } | 140 } |
137 | 141 else |
138 static void | 142 { |
139 start_menu (char *title, char *target, int remove) | 143 msg ("remove_link %s\n", linkpath); |
144 if (_access (linkpath, 0) != 0) | |
145 return; /* doesn't exist */ | |
146 _rmdir (linkpath); | |
147 } | |
148 } | |
149 | |
150 static void | |
151 start_menu (char *title, char *target, int rem, char* args) | |
140 { | 152 { |
141 char path[_MAX_PATH]; | 153 char path[_MAX_PATH]; |
142 LPITEMIDLIST id; | 154 LPITEMIDLIST id; |
143 int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; | 155 int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; |
144 SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id); | 156 SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_COMMON_PROGRAMS : CSIDL_PROGRAMS, &id); |
150 SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); | 162 SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); |
151 SHGetPathFromIDList (id, path); | 163 SHGetPathFromIDList (id, path); |
152 msg("Program directory for program link changed to: %s",path); | 164 msg("Program directory for program link changed to: %s",path); |
153 } | 165 } |
154 // end of Win95 addition | 166 // end of Win95 addition |
155 strcat (path, "/"); | 167 strcat (path, "\\"); |
156 strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); | 168 strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); |
157 if (remove == 0) | 169 if (rem == 0) |
158 make_link (path, title, target); | 170 make_link (path, title, target, args); |
159 else | 171 else |
160 remove_link (path, title); | 172 remove_link (path, title); |
161 } | 173 } |
162 | 174 |
163 static void | 175 static void |
164 desktop_icon (char *title, char *target, int remove) | 176 desktop_icon (char *title, char *target, int rem) |
165 { | 177 { |
166 char path[_MAX_PATH]; | 178 char path[_MAX_PATH]; |
167 LPITEMIDLIST id; | 179 LPITEMIDLIST id; |
168 int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; | 180 int issystem = (root_scope == IDC_ROOT_SYSTEM) ? 1 : 0; |
169 //SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_DESKTOP : CSIDL_COMMON_DESKTOPDIRECTORY, &id); | 181 //SHGetSpecialFolderLocation (NULL, issystem ? CSIDL_DESKTOP : CSIDL_COMMON_DESKTOPDIRECTORY, &id); |
176 SHGetSpecialFolderLocation (NULL, CSIDL_DESKTOPDIRECTORY, &id); | 188 SHGetSpecialFolderLocation (NULL, CSIDL_DESKTOPDIRECTORY, &id); |
177 SHGetPathFromIDList (id, path); | 189 SHGetPathFromIDList (id, path); |
178 msg("Desktop directory for deskop link changed to: %s",path); | 190 msg("Desktop directory for deskop link changed to: %s",path); |
179 } | 191 } |
180 // end of Win95 addition | 192 // end of Win95 addition |
181 if (remove == 0) | 193 if (rem == 0) |
182 make_link (path, title, target); | 194 make_link (path, title, target, ""); |
183 else | 195 else |
184 remove_link (path, title); | 196 remove_link (path, title); |
185 } | 197 } |
186 | 198 |
187 static void | 199 static void |
208 } | 220 } |
209 | 221 |
210 void | 222 void |
211 remove_desktop_setup() | 223 remove_desktop_setup() |
212 { | 224 { |
213 start_menu ("XEmacs", 0, 1); | 225 start_menu ("XEmacs", 0, 1, 0); |
226 start_menu ("Uninstall XEmacs", 0, 1, 0); | |
227 start_menu (0, 0, 1, 0); | |
214 desktop_icon ("XEmacs", 0, 1); | 228 desktop_icon ("XEmacs", 0, 1); |
215 | 229 |
216 if (xemacs_package != 0) | 230 if (xemacs_package != 0) |
217 { | 231 { |
218 int issystem = (root_scope == IDC_ROOT_SYSTEM ? 1 : 0); | 232 #define FROB(exe) remove_app_path (exe) |
219 #define FROB(exe) remove_app_path ((exe), \ | 233 FROB (find_xemacs_exe_name ()); |
220 issystem) | |
221 /* FROB (find_xemacs_exe_name ()); */ | |
222 FROB ("runemacs.exe"); | 234 FROB ("runemacs.exe"); |
223 FROB ("xemacs.exe"); | 235 FROB ("xemacs.exe"); |
224 #undef FROB | 236 #undef FROB |
225 } | 237 } |
226 } | 238 } |
229 do_desktop_setup() | 241 do_desktop_setup() |
230 { | 242 { |
231 save_icon (); | 243 save_icon (); |
232 | 244 |
233 if (root_menu && batname) { | 245 if (root_menu && batname) { |
234 start_menu ("XEmacs", batname, 0); | 246 start_menu ("XEmacs", batname, 0, ""); |
247 start_menu ("Uninstall XEmacs", uninstname, 0, "-u"); | |
235 } | 248 } |
236 | 249 |
237 if (root_desktop && batname) { | 250 if (root_desktop && batname) { |
238 desktop_icon ("XEmacs", batname, 0); | 251 desktop_icon ("XEmacs", batname, 0); |
239 } | 252 } |
378 SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); | 391 SHGetSpecialFolderLocation (NULL, CSIDL_PROGRAMS, &id); |
379 SHGetPathFromIDList (id, path); | 392 SHGetPathFromIDList (id, path); |
380 msg ("Program directory for program link changed to: %s",path); | 393 msg ("Program directory for program link changed to: %s",path); |
381 } | 394 } |
382 // end of Win95 addition | 395 // end of Win95 addition |
383 strcat (path, "/"); | 396 strcat (path, "\\"); |
384 strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); | 397 strcat (path, XEMACS_INFO_XEMACS_ORG_REGISTRY_NAME); |
385 char *fname = concat (path, "/", title, ".lnk", 0); | 398 char *fname = concat (path, "\\", title, ".lnk", 0); |
386 | 399 |
387 if (_access (fname, 0) == 0) | 400 if (_access (fname, 0) == 0) |
388 return 0; /* already exists */ | 401 return 0; /* already exists */ |
389 | 402 |
390 fname = concat (path, "/", title, ".pif", 0); /* check for a pif as well */ | 403 fname = concat (path, "\\", title, ".pif", 0); /* check for a pif as well */ |
391 | 404 |
392 if (_access (fname, 0) == 0) | 405 if (_access (fname, 0) == 0) |
393 return 0; /* already exists */ | 406 return 0; /* already exists */ |
394 | 407 |
395 return IDC_ROOT_MENU; | 408 return IDC_ROOT_MENU; |
457 CoInitialize (NULL); | 470 CoInitialize (NULL); |
458 | 471 |
459 verinfo.dwOSVersionInfoSize = sizeof (verinfo); | 472 verinfo.dwOSVersionInfoSize = sizeof (verinfo); |
460 GetVersionEx (&verinfo); | 473 GetVersionEx (&verinfo); |
461 batname = 0; | 474 batname = 0; |
475 uninstname = 0; | |
462 | 476 |
463 if (xemacs_package != 0 && xemacs_package->type != TY_GENERIC) | 477 if (xemacs_package != 0 && xemacs_package->type != TY_GENERIC) |
464 { | 478 { |
465 batname = concat (find_xemacs_exe_path (), "\\", | 479 batname = concat (find_xemacs_exe_path (), "\\", |
466 find_xemacs_exe_name (), | 480 find_xemacs_exe_name (), |
467 0); | 481 0); |
482 uninstname = concat (find_xemacs_exe_path (), "\\", "setup.exe", 0); | |
468 root_desktop = check_desktop ("XEmacs", batname); | 483 root_desktop = check_desktop ("XEmacs", batname); |
469 root_menu = check_startmenu ("XEmacs", batname); | 484 root_menu = check_startmenu ("XEmacs", batname); |
470 reg_c = IDC_C_TYPE; | 485 reg_c = IDC_C_TYPE; |
471 reg_cpp = IDC_CPP_TYPE; | 486 reg_cpp = IDC_CPP_TYPE; |
472 reg_java = IDC_JAVA_TYPE; | 487 reg_java = IDC_JAVA_TYPE; |