diff --git a/ChangeLog b/ChangeLog index fc0b21d0e..a0c1b4344 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-03-20 Brian Matherly + * src/GrampsDb/_GrampsIniKeys.py: os independent path + 2006-03-20 Don Allingham * src/Editors/_EditPerson.py: call the callback if defined * src/SelectPerson.py: take out the profiling code diff --git a/src/Config/_GrampsIniKeys.py b/src/Config/_GrampsIniKeys.py index 3b4b6e22e..f2da905e1 100644 --- a/src/Config/_GrampsIniKeys.py +++ b/src/Config/_GrampsIniKeys.py @@ -27,6 +27,7 @@ Low-level handling of .ini keys. import os import time import ConfigParser +import errno NL = "\n" # FIX: newlines on Mac/Windows, if different? @@ -134,6 +135,12 @@ class IniKeyClient: if not filename: filename = self.filename if filename: + try: + head, tail = os.path.split( filename ) + os.makedirs( head ) + except OSError, e: + if e.errno != errno.EEXIST: + raise fp = open(filename, "w") fp.write(";; Gramps key file" + NL) fp.write((";; Automatically created at %s" % time.strftime("%Y/%m/%d %H:%M:%S")) + NL + NL) @@ -192,8 +199,7 @@ class IniKeyClient: def suggest_sync(self): self.save_ini() # save back to default file, if named -# FIX: not OS-path independent: -client = IniKeyClient(os.path.expanduser("~/.gramps/keys.ini")) +client = IniKeyClient(os.path.expanduser("~" + os.sep + ".gramps" + os.sep + "keys.ini")) #------------------------------------------------------------------------- #