Method
GLibPathBufset_filename
since: 2.76
Declaration [src]
gboolean
g_path_buf_set_filename (
GPathBuf* buf,
const char* file_name
)
Description [src]
Sets the file name of the path.
If the path buffer is empty, the filename is left unset and this
function returns FALSE
.
If the path buffer only contains the root element (on Unix-like operating
systems) or the drive (on Windows), this is the equivalent of pushing
the new file_name
.
If the path buffer contains a path, this is the equivalent of
popping the path buffer and pushing file_name
, creating a
sibling of the original path.
GPathBuf buf, cmp;
g_path_buf_init_from_path (&buf, "/");
g_path_buf_set_filename (&buf, "bar");
g_path_buf_init_from_path (&cmp, "/bar");
g_assert_true (g_path_buf_equal (&buf, &cmp));
g_path_buf_clear (&cmp);
g_path_buf_set_filename (&buf, "baz.txt");
g_path_buf_init_from_path (&cmp, "/baz.txt");
g_assert_true (g_path_buf_equal (&buf, &cmp);
g_path_buf_clear (&cmp);
g_path_buf_clear (&buf);
Available since: 2.76