Function

GLibget_current_dir

Declaration

gchar*
g_get_current_dir (
  void
)

Description

Gets the current directory.

The returned string should be freed when no longer needed. The encoding of the returned string is system defined. On Windows, it is always UTF-8.

Since GLib 2.40, this function will return the value of the “PWD” environment variable if it is set and it happens to be the same as the current directory. This can make a difference in the case that the current directory is the target of a symbolic link.

Return value

Type: gchar*

The current directory.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a file system path, using the OS encoding.