build_filename


Description:

[ CCode ( cname = "g_build_filename" ) ]
public string build_filename (string first_element, ...)

Creates a filename from a series of elements using the correct separator for filenames.

On Unix, this function behaves identically to `g_build_path (G_DIR_SEPARATOR_S, first_element, ....)`.

On Windows, it takes into account that either the backslash (`\` or slash (`/`) can be used as separator in filenames, but otherwise behaves as on UNIX. When file pathname separators need to be inserted, the one that last previously occurred in the parameters (reading from left to right ) is used.

No attempt is made to force the resulting filename to be an absolute path. If the first element is a relative path, the result will be a relative path.

Example: Build a file name:

public static int main (string[] args) {
// Output: ``my/full/path/to.txt``
string path = Path.build_filename ("my", "full", "path/to.txt");
print ("%s\n", path);
return 0;
}

valac --pkg glib-2.0 GLib.Path.build_filename.vala

Parameters:

first_element

the first element in the path

...

remaining elements in path, terminated by null

Returns:

a newly-allocated string that must be freed with g_free.


Namespace: GLib.Path
Package: glib-2.0