From 9ca3c1c269bffd402e5c81b7232d4ba8540d0cf9 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 11 Sep 2006 03:07:17 +0000 Subject: [PATCH] svn: r7309 --- gramps2/src/GrampsDb/_ReadGedcom.py | 6 +++--- gramps2/src/GrampsDb/_ReadXML.py | 20 ++++++++++---------- gramps2/src/ViewManager.py | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gramps2/src/GrampsDb/_ReadGedcom.py b/gramps2/src/GrampsDb/_ReadGedcom.py index d7778d9aa..8eccf2f6d 100644 --- a/gramps2/src/GrampsDb/_ReadGedcom.py +++ b/gramps2/src/GrampsDb/_ReadGedcom.py @@ -742,7 +742,7 @@ class GedcomParser(UpdateCallback): def find_file(self,fullname,altpath): tries = [] - fullname = fullname.replace('\\','/') + fullname = fullname.replace('\\',os.path.sep) tries.append(fullname) if os.path.isfile(fullname): @@ -987,7 +987,7 @@ class GedcomParser(UpdateCallback): (ok,path) = self.find_file(matches[2], self.dir_path) if not ok: self.warn(_("Could not import %s") % filename) - path = filename.replace('\\','/') + path = filename.replace('\\',os.path.sep) def func_obje_ignore(self, matches, media, level): self.ignore_sub_junk(level+1) @@ -2663,7 +2663,7 @@ class GedcomParser(UpdateCallback): (ok,path) = self.find_file(filename,self.dir_path) if not ok: self.warn(_("Could not import %s") % filename) - path = filename.replace('\\','/') + path = filename.replace('\\',os.path.sep) photo_handle = self.media_map.get(path) if photo_handle == None: photo = RelLib.MediaObject() diff --git a/gramps2/src/GrampsDb/_ReadXML.py b/gramps2/src/GrampsDb/_ReadXML.py index 8d3fa8beb..d6376744b 100644 --- a/gramps2/src/GrampsDb/_ReadXML.py +++ b/gramps2/src/GrampsDb/_ReadXML.py @@ -170,20 +170,20 @@ def importData(database, filename, callback=None,cl=0,use_trans=False): # copy all local images into .images directory db_dir = os.path.abspath(os.path.dirname(database.get_save_path())) db_base = os.path.basename(database.get_save_path()) - img_dir = "%s/%s.images" % (db_dir,db_base) + img_dir = "%s%s%s.images" % (db_dir,os.path.sep,db_base) first = not os.path.exists(img_dir) for m_id in database.get_media_object_handles(): mobject = database.get_object_from_handle(m_id) oldfile = mobject.get_path() - if oldfile and oldfile[0] != '/': + if oldfile and oldfile[0] != '//': if first: os.mkdir(img_dir) first = 0 - newfile = "%s/%s" % (img_dir,oldfile) + newfile = "%s%s%s" % (img_dir,os.path.sep,oldfile) try: - oldfilename = "%s/%s" % (basefile,oldfile) + oldfilename = "%s%s%s" % (basefile,os.path.sep,oldfile) shutil.copyfile(oldfilename,newfile) try: shutil.copystat(oldfilename,newfile) @@ -1002,9 +1002,9 @@ class GrampsParser(UpdateCallback): self.object.desc = attrs['description'] src = attrs["src"] if src: - if src[0] != '/': + if src[0] != os.path.sep: fullpath = os.path.abspath(self.filename) - src = os.path.dirname(fullpath) + '/' + src + src = os.path.dirname(fullpath) + os.path.sep + src self.object.path = src def start_childof(self,attrs): @@ -1181,9 +1181,9 @@ class GrampsParser(UpdateCallback): self.object.desc = attrs.get('description','') src = attrs.get("src",'') if src: - if src[0] != '/': + if src[0] != os.path.sep: fullpath = os.path.abspath(self.filename) - src = os.path.dirname(fullpath) + '/' + src + src = os.path.dirname(fullpath) + os.path.sep + src self.object.path = src def start_repo(self,attrs): @@ -1227,8 +1227,8 @@ class GrampsParser(UpdateCallback): self.pref.set_privacy(int(attrs[key])) elif key == "src": src = attrs["src"] - if src[0] != '/': - self.photo.set_path("%s/%s" % (self.base,src)) + if src[0] != os.path.sep: + self.photo.set_path("%s%s%s"%(self.base,os.path.sep,src)) else: self.photo.set_path(src) else: diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index 13af9aaad..08186250b 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -792,7 +792,7 @@ class ViewManager: self.state.db.set_save_path(filename) # Update window title - if filename[-1] == '/': + if filename[-1] == os.path.sep: filename = filename[:-1] name = os.path.basename(filename) if self.state.db.readonly: