One more change to ImportProGen (bug #4869), to solve some uppercase/lowercase issues

svn: r17360
This commit is contained in:
Kees Bakker 2011-04-30 20:29:31 +00:00
parent ab45ddbb26
commit f752fdcfcc

View File

@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2008-2008 Kees Bakker # Copyright (C) 2008-2011 Kees Bakker
# Copyright (C) 2008 Brian G. Matherly # Copyright (C) 2008 Brian G. Matherly
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
@ -166,7 +166,7 @@ def _get_defname(fname):
raise ProgenError(_("Not a Pro-Gen file")) raise ProgenError(_("Not a Pro-Gen file"))
return None, '?' return None, '?'
defname = lines[1].lower() defname = lines[1]
defname = defname.strip() defname = defname.strip()
# Strip drive, if any # Strip drive, if any
defname = re.sub( r'^\w:', '', defname ) defname = re.sub( r'^\w:', '', defname )
@ -174,16 +174,18 @@ def _get_defname(fname):
# Strip leading slash, if any. # Strip leading slash, if any.
if defname.startswith(os.sep): if defname.startswith(os.sep):
defname = defname[1:] defname = defname[1:]
#log.warning('_get_defname: fname=%(fname)s => defname=%(defname)s' % vars())
# Using the directory of <fname>, go to the parent directory until # Using the directory of <fname>, go to the parent directory until
# the DEF is found. # the DEF is found.
dir_, f = os.path.split(os.path.abspath(fname)) dir_, f = os.path.split(os.path.abspath(fname))
while dir_ and dir_ != os.sep: while dir_ and dir_ != os.sep:
#log.warning('_get_defname: dir=%(dir_)s => defname=%(defname)s' % vars())
newdefname = os.path.join(dir_, defname) newdefname = os.path.join(dir_, defname)
if os.path.exists(newdefname): if os.path.exists(newdefname):
return newdefname, defname return newdefname, defname
newdefname = newdefname.upper() newdefname = newdefname.lower()
if os.path.exists(newdefname): if os.path.exists(newdefname):
return newdefname, defname return newdefname, defname