### Function

# GLib test_get_filename

since: 2.38

#### Declaration

    const gchar*
    g_test_get_filename (
      GTestFileType file_type,
      const gchar* first_path,
      ...
    )

#### Description

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

This is the same as `g_test_build_filename()` with two differences. The first difference is that you must only use this function from within a testcase function. The second difference is that you need not free the return value — it will be automatically freed when the testcase finishes running.

It is safe to use this function from a thread inside of a testcase but you must ensure that all such uses occur before the main testcase function returns (ie: it is best to ensure that all threads have been joined).

Available since: 2.38

This function is not directly available to language bindings.

#### Parameters

`file_type`

  Type: `GTestFileType`

  The type of file (built vs. distributed)

`first_path`

  Type: `const gchar*`

  The first segment of the pathname.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  `NULL`-terminated additional path segments.

#### Return value

Type: `const gchar*`

The path, automatically freed at the end of the testcase.

The data is owned by the called function.
The value is a NUL terminated UTF-8 string.