CharacterSet.filenameDisplayBasename

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 g_filename_display_name() if you know the whole path, as it allows translation.

struct CharacterSet
static
string
filenameDisplayBasename
(
string filename
)

Parameters

filename string

an absolute pathname in the GLib file name encoding

Return Value

Type: string

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

Meta