From fa80fc16d6bafc0c93fe13a4e11f9a1fdf5f1d71 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 28 Nov 2006 21:50:34 +0000 Subject: [PATCH] 2006-11-28 Alex Roitman * src/plugins/MediaManager.py (get_rel_path): Correctly work out the drive letter for the path. svn: r7726 --- gramps2/ChangeLog | 6 ++++-- gramps2/src/plugins/MediaManager.py | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index a3aeb9a59..71c1b2b8d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-11-28 Alex Roitman + * src/plugins/MediaManager.py (get_rel_path): Correctly work out + the drive letter for the path. + 2006-11-27 Alex Roitman * src/DbLoader.py (DbLoader.save_as): Prohibit SaveAs into the currently opened database. @@ -5,8 +9,6 @@ opened database. * src/GrampsDb/_WriteXML.py (dump_person_ref): Properly export associations. - -2006-11-27 Alex Roitman * src/GrampsDb/_WriteGedcom.py (write_person): Typo. 2006-11-27 Martin Hawlisch diff --git a/gramps2/src/plugins/MediaManager.py b/gramps2/src/plugins/MediaManager.py index 65fbc19cf..a8c220b73 100644 --- a/gramps2/src/plugins/MediaManager.py +++ b/gramps2/src/plugins/MediaManager.py @@ -560,6 +560,13 @@ def get_rel_path(db_dir,obj_path): obj_dir = os.path.dirname(os.path.normpath(obj_path)) obj_name = os.path.basename(os.path.normpath(obj_path)) + # If the db_dir and obj_dir are on different drives (win only) + # then there cannot be a relative path. Return original obj_path + (db_drive,db_dir) = os.path.splitdrive(db_dir) + (obj_drive,obj_dir) = os.path.splitdrive(obj_dir) + if db_drive.upper() != obj_drive.upper(): + return obj_path + # Get the list of dirnames for each db_dir_list = [word for word in db_dir.split(os.path.sep) if word] obj_dir_list = [word for word in obj_dir.split(os.path.sep) if word]