build/linux: Add super-privileged 'personal-files' interface to GIMP snap

See: #15547

This needs approval from Cannonical and allows migrating app data from
older versions as well writting current app data outside the sandbox.
This commit is contained in:
Bruno Lopes 2026-01-23 07:51:39 -03:00
parent 22e9ccf72d
commit bcb9f5c73a
2 changed files with 22 additions and 0 deletions

View file

@ -41,6 +41,7 @@ apps:
- intel-npu
- npu-libs
- gimp-plugins
- gimp-config
extensions: [gnome]
layout:
@ -68,6 +69,10 @@ plugs:
interface: content
content: gimp-plugins-3
target: $SNAP/gimp-plugins
gimp-config:
interface: personal-files
write:
- $HOME/.config/GIMP
parts:
buildenv:

View file

@ -361,6 +361,23 @@ gimp_directory (void)
NULL);
}
const gchar *snap_path = g_getenv ("SNAP");
if (snap_path && g_file_test (snap_path, G_FILE_TEST_IS_DIR))
{
const gchar *snap_real_home = g_getenv ("SNAP_REAL_HOME");
if (snap_real_home == NULL)
gimp_dir = g_build_filename (g_get_home_dir (),
".config",
GIMPDIR, GIMP_USER_VERSION,
NULL);
else
gimp_dir = g_build_filename (snap_real_home,
".config",
GIMPDIR, GIMP_USER_VERSION,
NULL);
}
if (gimp_dir == NULL)
{
/* g_get_user_config_dir () always returns a path as a non-null