pub fn filename_display_basename(filename: impl AsRef<Path>) -> GString
Expand description

Returns the display basename for the particular filename, guaranteed to be valid UTF-8. The display name might not be identical to the filename, for instance there might be problems converting it to UTF-8, and some files can be translated in the display.

If GLib cannot make sense of the encoding of filename, as a last resort it replaces unknown characters with U+FFFD, the Unicode replacement character. You can search the result for the UTF-8 encoding of this character (which is “\357\277\275” in octal notation) to find out if filename was in an invalid encoding.

You must pass the whole absolute pathname to this functions so that translation of well known locations can be done.

This function is preferred over filename_display_name() if you know the whole path, as it allows translation.

filename

an absolute pathname in the GLib file name encoding

Returns

a newly allocated string containing a rendition of the basename of the filename in valid UTF-8