Replace deprecated g_basename with g_path_get_basename.

This commit is contained in:
David Hill 2014-06-16 11:45:26 -04:00
commit 9d6cd87b0f
5 changed files with 16 additions and 15 deletions

View file

@ -55,10 +55,13 @@ static void sig_dcc_destroyed(GET_DCC_REC *dcc)
char *dcc_get_download_path(const char *fname)
{
char *str, *downpath;
char *base;
base = g_path_get_basename(fname);
downpath = convert_home(settings_get_str("dcc_download_path"));
str = g_strconcat(downpath, G_DIR_SEPARATOR_S, g_basename(fname), NULL);
str = g_strconcat(downpath, G_DIR_SEPARATOR_S, base, NULL);
g_free(downpath);
g_free(base);
return str;
}

View file

@ -408,19 +408,14 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname,
handle = NULL;
}
fname = g_basename(fname);
str = g_path_get_basename(fname);
/* Replace all the spaces with underscore so that lesser
intelligent clients can communicate.. */
if (!settings_get_bool("dcc_send_replace_space_with_underscore"))
str = NULL;
else {
str = g_strdup(fname);
if (settings_get_bool("dcc_send_replace_space_with_underscore"))
g_strdelimit(str, " ", '_');
fname = str;
}
dcc = dcc_send_create(server, chat, target, fname);
dcc = dcc_send_create(server, chat, target, str);
g_free(str);
dcc->handle = handle;