Method
GLibPathBufpush
since: 2.76
Declaration [src]
GPathBuf*
g_path_buf_push (
GPathBuf* buf,
const char* path
)
Description [src]
Extends the given path buffer with path
.
If path
is absolute, it replaces the current path.
If path
contains a directory separator, the buffer is extended by
as many elements the path provides.
On Windows, both forward slashes and backslashes are treated as
directory separators. On other platforms, G_DIR_SEPARATOR_S
is the
only directory separator.
GPathBuf buf, cmp;
g_path_buf_init_from_path (&buf, "/tmp");
g_path_buf_push (&buf, ".X11-unix/X0");
g_path_buf_init_from_path (&cmp, "/tmp/.X11-unix/X0");
g_assert_true (g_path_buf_equal (&buf, &cmp));
g_path_buf_clear (&cmp);
g_path_buf_push (&buf, "/etc/locale.conf");
g_path_buf_init_from_path (&cmp, "/etc/locale.conf");
g_assert_true (g_path_buf_equal (&buf, &cmp));
g_path_buf_clear (&cmp);
g_path_buf_clear (&buf);
Available since: 2.76
Parameters
path
-
Type:
const char*
A path.
The data is owned by the caller of the method. The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.
Return value
Type: GPathBuf
The same pointer to buf
, for convenience.
The returned data is owned by the instance. |