Geary.Controller: Migrate release config if needed

If the current config directory is empty, go looking for config data
in other well known locations and if found, copy it all across from
the most recently modified directory.

This supports migrating config from non-Flatpak to Flatpak locations,
and release config to devel profile locations.

Fixes #326
This commit is contained in:
Michael Gratton 2020-10-13 23:42:53 +11:00 committed by Michael James Gratton
parent 468ea6df58
commit 9658e9e3b4
3 changed files with 177 additions and 3 deletions

View file

@ -858,6 +858,34 @@ public class Application.Client : Gtk.Application {
}
}
/**
* Returns a set of paths of possible config locations.
*
* This is useful only for migrating configuration from
* non-Flatpak to Flatpak or release-builds to non-release builds.
*/
internal GLib.File[] get_config_search_path() {
var paths = new GLib.File[] {};
var home = GLib.File.new_for_path(GLib.Environment.get_home_dir());
paths += home.get_child(
".config"
).get_child(
"geary"
);
paths += home.get_child(
".var"
).get_child(
"app"
).get_child(
"org.gnome.Geary"
).get_child(
"config"
).get_child(
"geary"
);
return paths;
}
/**
* Displays an error notification.
*