2007-04-30 18:03:28 +00:00
|
|
|
Index: library/eclipse.c
|
|
|
|
===================================================================
|
|
|
|
RCS file: /cvsroot/eclipse/platform-launcher/library/eclipse.c,v
|
|
|
|
retrieving revision 1.71
|
|
|
|
diff -u -r1.71 eclipse.c
|
|
|
|
--- library/eclipse.c 25 Apr 2006 14:31:50 -0000 1.71
|
2007-05-15 14:51:39 +00:00
|
|
|
+++ library/eclipse.c 14 May 2007 11:14:30 -0000
|
|
|
|
@@ -512,6 +512,8 @@
|
2007-04-30 18:03:28 +00:00
|
|
|
/* Get the command to start the Java VM. */
|
|
|
|
vmCommandArgs = getVMCommand( argc, argv );
|
|
|
|
|
|
|
|
+ addPlatformToTildeDotEclipse();
|
|
|
|
+
|
|
|
|
/* While the Java VM should be restarted */
|
|
|
|
vmCommand = vmCommandArgs;
|
|
|
|
while (vmCommand != NULL)
|
2006-11-28 19:55:16 +00:00
|
|
|
Index: library/gtk/eclipseGtk.c
|
|
|
|
===================================================================
|
|
|
|
RCS file: /cvsroot/eclipse/platform-launcher/library/gtk/eclipseGtk.c,v
|
|
|
|
retrieving revision 1.27
|
|
|
|
diff -u -r1.27 eclipseGtk.c
|
|
|
|
--- library/gtk/eclipseGtk.c 27 Mar 2006 18:25:42 -0000 1.27
|
2007-05-15 14:51:39 +00:00
|
|
|
+++ library/gtk/eclipseGtk.c 14 May 2007 11:14:30 -0000
|
|
|
|
@@ -335,3 +335,120 @@
|
2006-11-28 19:55:16 +00:00
|
|
|
gtk_main_quit();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+/* Add the platform to ~/.eclipse/org.eclipse.platform_3.2.0/configuration/org.eclipse.update/platform.xml */
|
|
|
|
+void addPlatformToTildeDotEclipse()
|
|
|
|
+{
|
2007-05-15 14:51:39 +00:00
|
|
|
+ gchar *platform_xml, *touched, *dot_eclipse;
|
2007-04-30 18:03:28 +00:00
|
|
|
+ gchar *rcp321_position;
|
|
|
|
+ gchar *platform_xml_contents;
|
|
|
|
+ GError *error = NULL;
|
2006-11-28 19:55:16 +00:00
|
|
|
+
|
|
|
|
+ platform_xml = g_strconcat(g_get_home_dir(), "/.eclipse/org.eclipse.platform_3.2.0/configuration/org.eclipse.update/platform.xml", NULL);
|
2007-05-15 14:51:39 +00:00
|
|
|
+ dot_eclipse = g_strconcat(g_get_home_dir(), "/.eclipse", NULL);
|
2007-04-30 18:03:28 +00:00
|
|
|
+ touched = g_strconcat(g_get_home_dir(), "/.eclipse/.homedirmodified-fedora", NULL);
|
2006-11-28 19:55:16 +00:00
|
|
|
+
|
2007-04-27 08:48:33 +00:00
|
|
|
+
|
2007-05-15 14:51:39 +00:00
|
|
|
+ if (!g_file_test(dot_eclipse, G_FILE_TEST_EXISTS))
|
2007-04-27 08:48:33 +00:00
|
|
|
+ {
|
2007-05-15 14:51:39 +00:00
|
|
|
+ /* If .eclipse doesn't exist, Eclipse has yet to be started.
|
2007-04-27 08:48:33 +00:00
|
|
|
+ * We don't have worry about doing anything now and in the future
|
|
|
|
+ * so add the appropriate file to ~/.eclipse. */
|
2007-05-15 14:51:39 +00:00
|
|
|
+ if (g_mkdir(g_strconcat(g_get_home_dir(), "/.eclipse", NULL), 511) < 0)
|
2007-05-02 13:35:13 +00:00
|
|
|
+ {
|
|
|
|
+ g_print("Error creating ~/.eclipse/.");
|
2007-05-15 14:51:39 +00:00
|
|
|
+ g_free(platform_xml);
|
|
|
|
+ g_free(dot_eclipse);
|
|
|
|
+ g_free(touched);
|
|
|
|
+ return;
|
|
|
|
+
|
2007-05-02 13:35:13 +00:00
|
|
|
+ }
|
2007-04-27 08:48:33 +00:00
|
|
|
+ if (g_file_set_contents(touched, "\0", -1, &error) == FALSE)
|
|
|
|
+ {
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_print("Error touching ~/.eclipse/.homedirmodified-fedora.");
|
2007-04-27 08:48:33 +00:00
|
|
|
+ g_print(g_strconcat(error->message, "\n\0", NULL));
|
|
|
|
+ g_free(error);
|
2007-05-15 14:51:39 +00:00
|
|
|
+ g_free(platform_xml);
|
|
|
|
+ g_free(dot_eclipse);
|
|
|
|
+ g_free(touched);
|
|
|
|
+ return;
|
2007-04-27 08:48:33 +00:00
|
|
|
+ }
|
|
|
|
+
|
2007-05-15 14:51:39 +00:00
|
|
|
+ }
|
|
|
|
+ else if (g_file_test(platform_xml, G_FILE_TEST_EXISTS))
|
|
|
|
+ {
|
2007-04-30 18:03:28 +00:00
|
|
|
+ /* platform_xml exists, workaround these two bugs:
|
|
|
|
+ * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=238107
|
|
|
|
+ * https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=238109
|
|
|
|
+ *
|
|
|
|
+ * remove the unwanted feature if its in platform.xml */
|
|
|
|
+
|
2007-05-15 14:51:39 +00:00
|
|
|
+ if (g_file_get_contents(platform_xml, &platform_xml_contents, NULL, &error) == FALSE)
|
|
|
|
+ {
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_print("Error reading platform.xml in ~/.eclipse.\
|
|
|
|
+ You should remove ~/.eclipse before restarting Eclipse:\0");
|
|
|
|
+ g_print(g_strconcat(error->message, "\n\0", NULL));
|
|
|
|
+ g_free(error);
|
|
|
|
+ g_free(platform_xml);
|
|
|
|
+ g_free(touched);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ gchar *unwanted_feature = "<feature id=\"org.eclipse.rcp\" version=\"3.2.1.r321_v20060801-clWbqCmjexIWDqg\" url=\"features/org.eclipse.rcp_3.2.1.r321_v20060801-clWbqCmjexIWDqg/\">\n</feature>\0";
|
|
|
|
+ rcp321_position = g_strrstr(platform_xml_contents, unwanted_feature);
|
|
|
|
+
|
|
|
|
+ if (rcp321_position != NULL)
|
|
|
|
+ {
|
|
|
|
+ int i;
|
|
|
|
+ for (i = 0; i < strlen(unwanted_feature); i++) {
|
|
|
|
+ rcp321_position[i] = ' ';
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (g_file_set_contents(platform_xml, platform_xml_contents, -1, &error) == FALSE)
|
|
|
|
+ {
|
|
|
|
+ g_print("Error writing platform.xml in ~/.eclipse.\
|
|
|
|
+ You should remove ~/.eclipse before restarting Eclipse:\0");
|
2007-05-15 14:51:39 +00:00
|
|
|
+ g_print(g_strconcat(error->message, "\n\0", NULL));
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_free(error);
|
|
|
|
+ g_free(touched);
|
2007-05-15 14:51:39 +00:00
|
|
|
+ g_free(dot_eclipse);
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_free(platform_xml);
|
|
|
|
+ g_free(platform_xml_contents);
|
|
|
|
+ return;
|
2007-05-15 14:51:39 +00:00
|
|
|
+ }
|
2007-04-30 18:03:28 +00:00
|
|
|
+
|
2007-05-15 14:51:39 +00:00
|
|
|
+ g_free(platform_xml_contents);
|
2007-04-30 18:03:28 +00:00
|
|
|
+ }
|
|
|
|
+
|
2007-05-15 14:51:39 +00:00
|
|
|
+ g_free(dot_eclipse);
|
|
|
|
+ if (g_file_test(touched, G_FILE_TEST_EXISTS))
|
|
|
|
+ {
|
2007-04-27 08:48:33 +00:00
|
|
|
+ /* touched exists, we don't need to do anything */
|
|
|
|
+ g_free(platform_xml);
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_free(touched);
|
2007-04-27 08:48:33 +00:00
|
|
|
+ return;
|
2006-11-28 19:55:16 +00:00
|
|
|
+ }
|
|
|
|
+
|
2007-04-30 18:03:28 +00:00
|
|
|
+ /* At this point platform_xml exists and touched does not exist. */
|
2007-05-15 14:51:39 +00:00
|
|
|
+ if (g_file_test(platform_xml, G_FILE_TEST_EXISTS))
|
2006-11-28 19:55:16 +00:00
|
|
|
+ {
|
2007-05-15 14:51:39 +00:00
|
|
|
+ if (g_remove(platform_xml) < 0)
|
|
|
|
+ {
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_print("Error writing platform.xml in ~/.eclipse.\
|
2007-05-15 14:51:39 +00:00
|
|
|
+ You should remove ~/.eclipse before restarting Eclipse:\0");
|
|
|
|
+ g_free(platform_xml);
|
|
|
|
+ g_free(touched);
|
|
|
|
+ return;
|
|
|
|
+ }
|
2007-05-02 13:35:13 +00:00
|
|
|
+ }
|
|
|
|
+ if (g_file_set_contents(touched, "\0", -1, &error) == FALSE)
|
|
|
|
+ {
|
|
|
|
+ g_print("Error touching ~/.eclipse/.homedirmodified-fedora.");
|
|
|
|
+ g_print(g_strconcat(error->message, "\n\0", NULL));
|
|
|
|
+ g_free(error);
|
2006-11-28 19:55:16 +00:00
|
|
|
+ }
|
2007-04-30 18:03:28 +00:00
|
|
|
+ g_free(platform_xml);
|
|
|
|
+ g_free(touched);
|
|
|
|
+ return;
|
2006-11-28 19:55:16 +00:00
|
|
|
+}
|