summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-04-27 17:25:34 +0200
committerBastien Nocera <hadess@hadess.net>2020-04-27 17:25:34 +0200
commit3108a5c206a53139ac987a2eda8eb17fcff5c41b (patch)
treebd1e01efdac520a23533a42f0db8b607b683e9e8
parent3d34993343f6332384309832cc5c01023e565db8 (diff)
Make it possible to deprecate keys starting with X-
So we can throw warnings to make it easier to migrate to newer versions of the spec. test.desktop: warning: key "X-KDE-RunOnDiscreteGpu" in group "Desktop Entry" is deprecated
-rw-r--r--src/validate.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/validate.c b/src/validate.c
index c52b300..b6ed869 100644
--- a/src/validate.c
+++ b/src/validate.c
@@ -2249,9 +2249,6 @@ validate_known_key (kf_validator *kf,
unsigned int i;
unsigned int j;
- if (!strncmp (key, "X-", 2))
- return TRUE;
-
for (i = 0; i < n_keys; i++) {
if (strcmp (key, keys[i].name))
continue;
@@ -2259,6 +2256,8 @@ validate_known_key (kf_validator *kf,
if (keys[i].type != DESKTOP_LOCALESTRING_TYPE &&
keys[i].type != DESKTOP_LOCALESTRING_LIST_TYPE &&
locale != NULL) {
+ if (!strncmp (key, "X-", 2))
+ return TRUE;
print_fatal (kf, "file contains key \"%s\" in group \"%s\", "
"but \"%s\" is not defined as a locale string\n",
locale_key, kf->current_group, key);
@@ -2281,6 +2280,9 @@ validate_known_key (kf_validator *kf,
"KDE\n",
locale_key, kf->current_group);
+ if (!strncmp (key, "X-", 2))
+ return TRUE;
+
if (!validate_for_type[j].validate (kf, key, locale, value))
return FALSE;