Fix gconf schema convert script to keep leading slash in paths

This commit is contained in:
Vincent Untz
2010-04-14 20:55:26 -04:00
parent dd4dfd53c5
commit 7889b6125b

View File

@@ -537,18 +537,18 @@ def read_gconf_schema(gconf_schema_file):
schemas_only = (gconf_schema.applyto is not None) schemas_only = (gconf_schema.applyto is not None)
dirpath = gconf_schema.prefix dirpath = gconf_schema.prefix
# remove leading slash because there's none in gsettings, and trailing if dirpath[0] != '/':
# slash because we'll split the string raise GSettingsSchemaConvertException('Key is not absolute: %s' % gconf_schema.prefix)
if dirpath[0] == '/':
dirpath = dirpath[1:] # remove trailing slash because we'll split the string
if dirpath[-1] == '/': if dirpath[-1] == '/':
dirpath = dirpath[:-1] dirpath = dirpath[:-1]
# remove leading 'schemas/' for schemas-only keys # remove leading 'schemas/' for schemas-only keys
if schemas_only and dirpath.startswith('schemas/'): if schemas_only and dirpath.startswith('/schemas/'):
dirpath = dirpath[len('schemas/'):] dirpath = dirpath[len('/schemas'):]
if not dirpath: if len(dirpath) == 1:
raise GSettingsSchemaConvertException('Toplevel keys are not accepted: %s' % gconf_schema.applyto) raise GSettingsSchemaConvertException('Toplevel keys are not accepted: %s' % gconf_schema.prefix)
hierarchy = dirpath.split('/') hierarchy = dirpath.split('/')