summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-09-07 12:48:16 +0200
committerBastien Nocera <hadess@hadess.net>2020-09-14 11:15:33 +0200
commit8b9af642543c4719957f61f2b610fa72e26f904c (patch)
treec76c109e6bb04c6e0ea2e2651ae1a15bfe7b8e97
parentffc66e81d9c15b08a98bba188d0cdb84a7b01b31 (diff)
downloadflatpak-wip/hadess/skewered-app-ids.tar.gz
common: Allow skewering when converting in app-id for DConf migrationwip/hadess/skewered-app-ids
Allow a snake-case in the app-id to convert to a '-' or '_' in the DConf path to be considered similar enough for DConf migration purposes. This allows the org.gnome.SoundJuicer app-id to migrate its /org/gnome/sound-juicer DConf path. F: Ignoring D-Conf migrate-path setting /org/gnome/sound-juicer/
-rw-r--r--common/flatpak-utils.c7
-rw-r--r--tests/testcommon.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c
index fa6f2dfa..09e3d779 100644
--- a/common/flatpak-utils.c
+++ b/common/flatpak-utils.c
@@ -7540,6 +7540,13 @@ flatpak_dconf_path_is_similar (const char *path1,
if (path2[i2] == '\0')
break;
+ if (isupper(path1[i1]) &&
+ (path2[i2] == '-' || path2[i2] == '_'))
+ i2++;
+
+ if (path2[i2] == '\0')
+ break;
+
if (tolower (path1[i1]) == tolower (path2[i2]))
{
if (path1[i1] == '/')
diff --git a/tests/testcommon.c b/tests/testcommon.c
index 89bb7020..a5dfc6d4 100644
--- a/tests/testcommon.c
+++ b/tests/testcommon.c
@@ -1149,6 +1149,10 @@ test_dconf_paths (void)
{ "/org/gnome1/Rhythmbox/", "/org/gnome/rhythmbox", 0 },
{ "/org/gnome1/Rhythmbox", "/org/gnome/rhythmbox/", 0 },
{ "/org/gnome/Rhythmbox3plus/", "/org/gnome/rhythmbox/", 0 },
+ { "/org/gnome/SoundJuicer/", "/org/gnome/sound-juicer/", 1 },
+ { "/org/gnome/Sound-Juicer/", "/org/gnome/sound-juicer/", 1 },
+ { "/org/gnome/Soundjuicer/", "/org/gnome/sound-juicer/", 0 },
+ { "/org/gnome/Soundjuicer/", "/org/gnome/soundjuicer/", 1 },
};
int i;