summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/common/cfgfiles.c12
-rw-r--r--src/common/dbus/dbus-plugin.c2
-rw-r--r--src/common/hexchat.c2
-rw-r--r--src/common/plugin.c10
-rw-r--r--src/common/server.c2
-rw-r--r--src/common/servlist.c2
-rw-r--r--src/common/util.c4
-rw-r--r--src/fe-gtk/menu.c2
-rw-r--r--src/fe-gtk/plugingui.c2
9 files changed, 19 insertions, 19 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 9e0146c4..76ed564f 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -112,7 +112,7 @@ list_loadconf (char *file, GSList ** list, char *defaultconf)
 	int fd;
 	struct stat st;
 
-	filebuf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), file);
+	filebuf = g_build_filename (get_xdir (), file, NULL);
 	fd = g_open (filebuf, O_RDONLY | OFLAGS, 0);
 	g_free (filebuf);
 
@@ -327,10 +327,10 @@ get_xdir (void)
 		}
 		else
 		{
-			xdir = g_strdup_printf ("%s\\" "HexChat", out);
+			xdir = g_build_filename (out, "HexChat", NULL);
 		}
 #else
-		xdir = g_strdup_printf ("%s/" HEXCHAT_DIR, g_get_user_config_dir ());
+		xdir = g_build_filename (g_get_user_config_dir (), HEXCHAT_DIR, NULL);
 #endif
 	}
 
@@ -361,7 +361,7 @@ default_file (void)
 
 	if (!dfile)
 	{
-		dfile = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "hexchat.conf", get_xdir ());
+		dfile = g_build_filename (get_xdir (), "hexchat.conf", NULL);
 	}
 	return dfile;
 }
@@ -1179,7 +1179,7 @@ hexchat_open_file (char *file, int flags, int mode, int xof_flags)
 			return g_open (file, flags | OFLAGS, 0);
 	}
 
-	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), file);
+	buf = g_build_filename (get_xdir (), file, NULL);
 
 	if (xof_flags & XOF_DOMODE)
 	{
@@ -1204,7 +1204,7 @@ hexchat_fopen_file (const char *file, const char *mode, int xof_flags)
 	if (xof_flags & XOF_FULLPATH)
 		return fopen (file, mode);
 
-	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), file);
+	buf = g_build_filename (get_xdir (), file, NULL);
 	fh = g_fopen (buf, mode);
 	g_free (buf);
 
diff --git a/src/common/dbus/dbus-plugin.c b/src/common/dbus/dbus-plugin.c
index 2467c845..62b83bb1 100644
--- a/src/common/dbus/dbus-plugin.c
+++ b/src/common/dbus/dbus-plugin.c
@@ -373,7 +373,7 @@ remote_object_connect (RemoteObject *obj,
 		g_free (sender);
 		return TRUE;
 	}
-	path = g_strdup_printf (DBUS_OBJECT_PATH"/%d", count++);
+	path = g_build_filename (DBUS_OBJECT_PATH, count++, NULL);
 	remote_object = g_object_new (REMOTE_TYPE_OBJECT, NULL);
 	remote_object->dbus_path = path;
 	remote_object->filename = g_path_get_basename (filename);
diff --git a/src/common/hexchat.c b/src/common/hexchat.c
index f5f4232e..cef391d2 100644
--- a/src/common/hexchat.c
+++ b/src/common/hexchat.c
@@ -438,7 +438,7 @@ irc_init (session *sess)
 	}
 
 	/* load -e <xdir>/startup.txt */
-	buf = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "startup.txt", get_xdir ());
+	buf = g_build_filename (get_xdir (), "startup.txt", NULL);
 	load_perform_file (sess, buf);
 	g_free (buf);
 }
diff --git a/src/common/plugin.c b/src/common/plugin.c
index c9183ede..686f9749 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -477,7 +477,7 @@ plugin_auto_load (session *sess)
 	char *sub_dir;
 	ps = sess;
 
-	sub_dir = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "addons", get_xdir ());
+	sub_dir = g_build_filename (get_xdir (), "addons", NULL);
 
 #ifdef WIN32
 	/* a long list of bundled plugins that should be loaded automatically,
@@ -1670,9 +1670,9 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
 			g_free (buffer);
 			close (fhOut);
 
-			buffer = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), confname);
+			buffer = g_build_filename (get_xdir (), confname, NULL);
 			g_free (confname);
-			buffer_tmp = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), confname_tmp);
+			buffer_tmp = g_build_filename (get_xdir (), confname_tmp, NULL);
 			g_free (confname_tmp);
 
 #ifdef WIN32
@@ -1744,9 +1744,9 @@ hexchat_pluginpref_set_str_real (hexchat_plugin *pl, const char *var, const char
 
 		close (fhOut);
 
-		buffer = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), confname);
+		buffer = g_build_filename (get_xdir (), confname, NULL);
 		g_free (confname);
-		buffer_tmp = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), confname_tmp);
+		buffer_tmp = g_build_filename (get_xdir (), confname_tmp, NULL);
 		g_free (confname_tmp);
 
 #ifdef WIN32
diff --git a/src/common/server.c b/src/common/server.c
index 1f4f626e..26d9a7cb 100644
--- a/src/common/server.c
+++ b/src/common/server.c
@@ -1713,7 +1713,7 @@ server_connect (server *serv, char *hostname, int port, int no_login)
 		else
 		{
 			/* if that doesn't exist, try <config>/certs/client.pem */
-			cert_file = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "certs" G_DIR_SEPARATOR_S "client.pem", get_xdir ());
+			cert_file = g_build_filename (get_xdir (), "certs", "client.pem", NULL);
 			if (SSL_CTX_use_certificate_file (ctx, cert_file, SSL_FILETYPE_PEM) == 1)
 				SSL_CTX_use_PrivateKey_file (ctx, cert_file, SSL_FILETYPE_PEM);
 		}
diff --git a/src/common/servlist.c b/src/common/servlist.c
index 365b3c17..860432d5 100644
--- a/src/common/servlist.c
+++ b/src/common/servlist.c
@@ -1214,7 +1214,7 @@ servlist_save (void)
 #ifndef WIN32
 	int first = FALSE;
 
-	buf = g_strdup_printf ("%s/servlist.conf", get_xdir ());
+	buf = g_build_filename (get_xdir (), "servlist.conf", NULL);
 	if (g_access (buf, F_OK) != 0)
 		first = TRUE;
 #endif
diff --git a/src/common/util.c b/src/common/util.c
index 9ce23879..29a0f3ed 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1691,8 +1691,8 @@ move_file (char *src_dir, char *dst_dir, char *fname, int dccpermissions)
 		 0 == dst_dir[0])
 		return;			/* Already in "completed dir" */
 
-	src = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", src_dir, fname);
-	dst = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", dst_dir, fname);
+	src = g_build_filename (src_dir, fname, NULL);
+	dst = g_build_filename (dst_dir, fname, NULL);
 
 	/* already exists in completed dir? Append a number */
 	if (file_exists (dst))
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c
index e6fef6a0..f0f49730 100644
--- a/src/fe-gtk/menu.c
+++ b/src/fe-gtk/menu.c
@@ -281,7 +281,7 @@ menu_quick_item (char *cmd, char *label, GtkWidget * menu, int flags,
 			else
 			{
 				/* try relative to <xdir> */
-				path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s", get_xdir (), icon);
+				path = g_build_filename (get_xdir (), icon, NULL);
 				if (access (path, R_OK) == 0)
 					img = gtk_image_new_from_file (path);
 				else
diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c
index 48152d78..129d88ac 100644
--- a/src/fe-gtk/plugingui.c
+++ b/src/fe-gtk/plugingui.c
@@ -133,7 +133,7 @@ plugingui_load (void)
 {
 	char *sub_dir;
 
-	sub_dir = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "addons", get_xdir());
+	sub_dir = g_build_filename (get_xdir(), "addons", NULL);
 
 	gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
 #ifdef WIN32