Application.Client: Ensure non-release builds don't clobber release data
Append the build profile to Geary's data directories when not running a release build (or under Flatpak) so that e.g. development builds use different config, cache and data directories. This allows us to perform things like database schema updates with relative abandon, since if we ask people to test development builds with schema updates, they can always safely go back to their release builds again.
This commit is contained in:
parent
99fc14a4e5
commit
368a0ced97
1 changed files with 19 additions and 3 deletions
|
|
@ -777,21 +777,21 @@ public class Application.Client : Gtk.Application {
|
|||
public GLib.File get_home_config_directory() {
|
||||
return GLib.File.new_for_path(
|
||||
Environment.get_user_config_dir()
|
||||
).get_child("geary");
|
||||
).get_child(get_geary_home_dir_name());
|
||||
}
|
||||
|
||||
/** Returns the application's base home cache directory. */
|
||||
public GLib.File get_home_cache_directory() {
|
||||
return GLib.File.new_for_path(
|
||||
GLib.Environment.get_user_cache_dir()
|
||||
).get_child("geary");
|
||||
).get_child(get_geary_home_dir_name());
|
||||
}
|
||||
|
||||
/** Returns the application's base home data directory. */
|
||||
public GLib.File get_home_data_directory() {
|
||||
return GLib.File.new_for_path(
|
||||
GLib.Environment.get_user_data_dir()
|
||||
).get_child("geary");
|
||||
).get_child(get_geary_home_dir_name());
|
||||
}
|
||||
|
||||
/** Returns the application's base static resources directory. */
|
||||
|
|
@ -1188,6 +1188,22 @@ public class Application.Client : Gtk.Application {
|
|||
}
|
||||
}
|
||||
|
||||
private string get_geary_home_dir_name() {
|
||||
// Return the standard name if running a release build or
|
||||
// running under Flatpak, otherwise append the build profile
|
||||
// as a suffix so (e.g.) devel builds don't mess with release
|
||||
// build's config and databases.
|
||||
//
|
||||
// Note that non-release Flatpak builds already have their own
|
||||
// separate directories since they have different app ids, and
|
||||
// hence don't need the suffix.
|
||||
return (
|
||||
_PROFILE == PROFILE_RELEASE || this.is_flatpak_sandboxed
|
||||
? "geary"
|
||||
: "geary-" + _PROFILE
|
||||
);
|
||||
}
|
||||
|
||||
private void on_activate_about() {
|
||||
this.show_about.begin();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue