From cdf799b0d65b1fdd468bd70bb4940ba3bbf897aa Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Tue, 28 Jun 2011 16:20:52 +0200 Subject: [PATCH] make appendfiles use relative filenames to the label file location --- sloth/core/commands.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sloth/core/commands.py b/sloth/core/commands.py index 8851ff5..759ddc0 100644 --- a/sloth/core/commands.py +++ b/sloth/core/commands.py @@ -1,10 +1,11 @@ import sys +import os import sloth import shutil from pprint import pprint from sloth.core.cli import BaseCommand, CommandError from sloth.annotations.container import * -from optparse import make_option, OptionParser +from optparse import make_option class ConvertCommand(BaseCommand): """ @@ -82,7 +83,12 @@ class AppendFilesCommand(BaseCommand): self.labeltool.loadAnnotations(args[0]) for filename in args[1:]: - self.labeltool.addImageFile(filename) + rel_filename = filename + try: + rel_filename = os.path.relpath(filename, os.path.dirname(args[0])) + except: + pass + self.labeltool.addImageFile(rel_filename) self.labeltool.saveAnnotations(args[0])