build_filename


Description:

[ Version ( since = "2.38" ) ]
public string build_filename (FileType file_type, string[] path_segments)

Creates the pathname to a data file that is required for a test.

This function is conceptually similar to [func@GLib.build_filename] except that the first argument has been replaced with a [ enum@GLib.TestFileType] argument.

The data file should either have been distributed with the module containing the test ([enum@GLib.TestFileType.dist] or built as part of the buildcsystem of that module ([enum@GLib.TestFileType.built]).

In order for this function to work in srcdir != builddir situations, the `G_TEST_SRCDIR` and `G_TEST_BUILDDIR` environment variables need to have been defined. As of 2.38, this is done by the glib.mk that is included in GLib. Please ensure that your copy is up to date before using this function.

In case neither variable is set, this function will fall back to using the dirname portion of `argv[0]`, possibly removing ".libs". This allows for casual running of tests directly from the commandline in the srcdir == builddir case and should also support running of installed tests, assuming the data files have been installed in the same relative path as the test binary.

Parameters:

file_type

the type of file (built vs. distributed)

first_path

the first segment of the pathname

...

`NULL`-terminated additional path segments

Returns:

the path of the file, to be freed using [func@GLib.free]


Namespace: GLib.Test
Package: glib-2.0