Use display name instead of basename for showing filenames
https://developer.gnome.org/gio/stable/GFile.html
All GFiles have a basename (get with
g_file_get_basename()
). These names are byte strings that are used to identify the file on the filesystem (relative to its parent directory) and there is no guarantees that they have any particular charset encoding or even make any sense at all. If you want to use filenames in a user interface you should use the display name that you can get by requesting theG_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
attribute withg_file_query_info()
. This is guaranteed to be in UTF-8 and can be used in a user interface. But always store the real basename or the GFile to use to actually access the file, because there is no way to go from a display name to the actual name.
Currently we use File.get_basename()
for everything, incl. filename-based game titles. This isn't correct and won't work well with non-UTF8 encodings. Even though so far we haven't had any problems with this, we should switch to display name.