I am trying to get the name of a file when I select it using a file chooser.
I managed to do
gchar *name = gtk_file_chooser_get_filename(open_dialog);
but that will return /home/user/Desktop/test.file and not test.file which I want to.
Is there any method to get the name of the file and not the uri of it?
How do you open the file if you have no the whole “URI” (path) to it?? If you want only
test.fileyou can extract it from the whole path. There’s the POSIX function basename and glib has a function too: g_path_get_basename.