changeset 1025:84a5d80e52f1

[gaim-migrate @ 1035] remember which directory you got the last plugin from and default to /usr/local/lib/gaim/ which is where they get installed by default (please fix this, it needs to be $libdir but i don't know how to get that from configure) committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 26 Oct 2000 02:12:34 +0000
parents 66481301d972
children 5bad25457843
files src/plugins.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins.c	Thu Oct 26 00:57:41 2000 +0000
+++ b/src/plugins.c	Thu Oct 26 02:12:34 2000 +0000
@@ -63,6 +63,7 @@
 
 static GtkWidget *config = NULL;
 static guint confighandle = 0;
+static char *last_dir = NULL;
 
 /* --------------- Function Declarations --------------------- */
 
@@ -92,7 +93,6 @@
 static void load_file(GtkWidget *w, gpointer data)
 {
 	gchar *buf;
-	FILE *fd;
  
 	if (plugin_dialog) {
 		gtk_widget_show(plugin_dialog);
@@ -105,12 +105,11 @@
 	gtk_file_selection_hide_fileop_buttons(
 					GTK_FILE_SELECTION(plugin_dialog));
 
-	buf = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, PLUGIN_DIR, NULL);
-	fd = fopen(buf, "r");
-	if (!fd)
-		mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
+	if (!last_dir)
+		/* someone fix me please, how do we get the dir from configure? */
+		buf = g_strdup("/usr/local/lib/gaim/");
 	else
-		fclose(fd);
+		buf = g_strconcat(last_dir, G_DIR_SEPARATOR_S, NULL);
 
 	gtk_file_selection_set_filename(GTK_FILE_SELECTION(plugin_dialog), buf);
 	gtk_file_selection_complete(GTK_FILE_SELECTION(plugin_dialog), "*.so");
@@ -164,6 +163,10 @@
 	else
 		plug->filename = g_strdup(filename);
 
+	if (last_dir)
+		g_free(last_dir);
+	last_dir = g_dirname(plug->filename);
+
 	debug_printf("Loading %s\n", filename);
 	/* do NOT `OR' with RTLD_GLOBAL, otherwise plugins may conflict
 	 * (it's really just a way to work around other people's bad