Method

GLibPathBufpop

since: 2.76

Declaration

gboolean
g_path_buf_pop (
  GPathBuf* buf
)

Description

Removes the last element of the path buffer.

If there is only one element in the path buffer (for example, / on Unix-like operating systems or the drive on Windows systems), it will not be removed and FALSE will be returned instead.

GPathBuf buf, cmp;

g_path_buf_init_from_path (&buf, "/bin/sh");

g_path_buf_pop (&buf);
g_path_buf_init_from_path (&cmp, "/bin");
g_assert_true (g_path_buf_equal (&buf, &cmp));
g_path_buf_clear (&cmp);

g_path_buf_pop (&buf);
g_path_buf_init_from_path (&cmp, "/");
g_assert_true (g_path_buf_equal (&buf, &cmp));
g_path_buf_clear (&cmp);

g_path_buf_clear (&buf);

Available since: 2.76

Return value

Type: gboolean

TRUE if the buffer was modified and FALSE otherwise.