From 59ebcc85adf41f055766efa43bf308b6ec23fdf4 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Sat, 11 Apr 2009 21:57:45 +0000 Subject: [PATCH] * morituri/image/image.py: If paths are relative, make them relative to cue file. --- ChangeLog | 5 +++++ morituri/image/image.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0cbaa6e..8a18f44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-04-11 Thomas Vander Stichele + + * morituri/image/image.py: + If paths are relative, make them relative to cue file. + 2009-04-11 Thomas Vander Stichele * morituri/common/task.py: diff --git a/morituri/image/image.py b/morituri/image/image.py index e0ea5df..2dd07a3 100644 --- a/morituri/image/image.py +++ b/morituri/image/image.py @@ -45,8 +45,12 @@ class Image: if os.path.exists(path): return path - # .cue FILE statements have Windows-style path separators + # .cue FILE statements have Windows-style path separators, so convert tpath = os.path.join(*path.split('\\')) + # if the path is relative, make it absolute relative to the cue file + if tpath != os.path.abspath(tpath): + tpath = os.path.join(os.path.dirname(self._path), tpath) + noext, _ = os.path.splitext(tpath) for ext in ['wav', 'flac']: cpath = '%s.%s' % (noext, ext)