[glib/new-gsettings] Fix gconf schema convert script to keep leading slash in paths



commit 7889b6125b682d2269a36e2b602f0763c21f58a8
Author: Vincent Untz <vuntz gnome org>
Date:   Wed Apr 14 20:55:26 2010 -0400

    Fix gconf schema convert script to keep leading slash in paths

 gio/gsettings-schema-convert |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gio/gsettings-schema-convert b/gio/gsettings-schema-convert
index 2318dad..9200560 100755
--- a/gio/gsettings-schema-convert
+++ b/gio/gsettings-schema-convert
@@ -537,18 +537,18 @@ def read_gconf_schema(gconf_schema_file):
             schemas_only = (gconf_schema.applyto is not None)
 
             dirpath = gconf_schema.prefix
-            # remove leading slash because there's none in gsettings, and trailing
-            # slash because we'll split the string
-            if dirpath[0] == '/':
-                dirpath = dirpath[1:]
+            if dirpath[0] != '/':
+                raise GSettingsSchemaConvertException('Key is not absolute: %s' % gconf_schema.prefix)
+
+            # remove trailing slash because we'll split the string
             if dirpath[-1] == '/':
                 dirpath = dirpath[:-1]
             # remove leading 'schemas/' for schemas-only keys
-            if schemas_only and dirpath.startswith('schemas/'):
-                dirpath = dirpath[len('schemas/'):]
+            if schemas_only and dirpath.startswith('/schemas/'):
+                dirpath = dirpath[len('/schemas'):]
 
-            if not dirpath:
-                raise GSettingsSchemaConvertException('Toplevel keys are not accepted: %s' % gconf_schema.applyto)
+            if len(dirpath) == 1:
+                raise GSettingsSchemaConvertException('Toplevel keys are not accepted: %s' % gconf_schema.prefix)
 
             hierarchy = dirpath.split('/')
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]