@dolik-rce commented on this pull request.
I just hope I didn't introduce any stupid memory leak. It's been years since I had to manage memory manually.
@@ -276,13 +276,24 @@ static GeanyFiletype *filetypes_detect(const gchar *utf8_filename)
}
+static gboolean string_exists_in_array(gchar **array, gchar *str) {
I'm pretty sure this function already exists in glib or somewhere... I just couldn't find it :roll_eyes:
@@ -497,13 +509,51 @@ gchar **prjorg_project_load_expanded_paths(GKeyFile * key_file)
}
+static GPtrArray *get_session_files(GKeyFile *config)
This is mostly ~~stolen from~~ inspired by `configuration_load_session_files` in Geany. The only difference is that this one only reads the filename.
+ files = g_ptr_array_new(); + have_session_files = TRUE; + i = 0; + while (have_session_files) + { + g_snprintf(entry, sizeof(entry), "FILE_NAME_%d", i); + tmp_array = g_key_file_get_string_list(config, "files", entry, NULL, &error); + if (! tmp_array || error) + { + g_error_free(error); + error = NULL; + have_session_files = FALSE; + } else { + unescaped_filename = g_uri_unescape_string(tmp_array[7], NULL); + locale_filename = utils_get_locale_from_utf8(unescaped_filename);
Hm, thinking about it now: This should probably not be here. I think conversion to locale should only be used for display purposes, but all internal filenames should be handled in UTF-8, right?