Replace g_strdup_printf with g_build_filename where possible
This commit is contained in:
parent
b2317d8800
commit
fb01d4e9ab
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue