-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing 5.1.x after 5.2.x will no longer override config/data locations #1708
Installing 5.1.x after 5.2.x will no longer override config/data locations #1708
Conversation
… locations In an 5.2.x installations with XDG directory layout for data/config/cache, installing 5.1.x later would create a second config folder in the legacy layout, overriding the existing config. This change makes it so that if an existing configuration exists for 5.2.x, it will be given preference over the 5.1.x config. If there isn't one, previous logic will continue to be used.
USER_DATA = os.path.join(GLib.get_user_data_dir(), "gramps") | ||
USER_CONFIG = os.path.join(GLib.get_user_config_dir(), "gramps") | ||
USER_CACHE = os.path.join(GLib.get_user_cache_dir(), "gramps") | ||
if os.path.exists(USER_DATA) and os.path.exists(USER_CONFIG): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First we check for the existence of XDG-based config created by 5.2.x or newer. If it exists, prefer it over legacy config folders.
The if
condition could be merged into elif
later on but at the cost of readability/understandability, so I left it this way with a pass statement.
macOS, at least in the AIO bundle, isn't affected by the bug and this change is harmless. |
Thanks for reviewing the change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works on Linux, but the GRAMPSHOME
and SAFEMODE
options are ignored if the new directory structure exists.
The GRAMPSHOME
environment variable is used to specify a base directory for all data and configuration file storage. The safe mode works by setting this to an empty directory.
@Nick-Hall Returning to this defect after a while. Discovered a related bug while trying out safe mode, which affects the testing of this one so I think it needs to be fixed first: 13300. It would be very convenient if the root cause of that turns out to be the same as this one. |
@Nick-Hall Turns out that this defect is a side-effect of 13300, and the fix for that is in PR #1726 (gramps52) and PR #1725 (master). I'm closing this PR in favor of those. |
Fix #13261
In an existing 5.2.x installation with XDG directory layout for data/config/cache, installing 5.1.x later would create a second config folder in the legacy layout, overriding the existing config.
This change makes it so that an existing configuration for 5.2.x will be given preference over the 5.1.x config. If there isn't one, previous logic will continue to be used.
Testing passed on Windows
Thanks!