From 449a70c5636d47f699c59b5d483711be82d52908 Mon Sep 17 00:00:00 2001
From: Tiago Freitas Pereira <tiagofrepereira@gmail.com>
Date: Wed, 23 May 2018 15:16:29 +0200
Subject: [PATCH] Organized the --sub-directory option and automatically
 deleted the temp file

Put the temp files back

Organized the --sub-directories for the baselines
---
 bob/bio/base/script/baseline.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/bob/bio/base/script/baseline.py b/bob/bio/base/script/baseline.py
index 59a8e93b..63758fae 100644
--- a/bob/bio/base/script/baseline.py
+++ b/bob/bio/base/script/baseline.py
@@ -14,6 +14,7 @@ from bob.extension.scripts.click_helper import verbosity_option
 import click
 import tempfile
 import logging
+import os
 
 logger = logging.getLogger("bob.bio.base")
 
@@ -59,6 +60,12 @@ def baseline(ctx, baseline, database):
     db = search_preprocessor(database, loaded_baseline.preprocessors.keys())
     preprocessor = loaded_baseline.preprocessors[db]
 
+    # this is the default sub-directory that is used
+    if "-T" in ctx.args or  "--temp-directory" in ctx.args:
+        sub_directory = os.path.join(database, baseline)
+    else:
+        sub_directory = baseline
+        
     logger.debug('Database groups are %s', database_data["groups"])
 
     # call verify with newly generated config file. We will create a new config
@@ -77,7 +84,7 @@ verbose = {verbose}
         extractor=loaded_baseline.extractor,
         algorithm=loaded_baseline.algorithm,
         database=database,
-        sub_directory=baseline,
+        sub_directory=sub_directory,
         groups="', '".join(database_data["groups"]),
         verbose=ctx.meta['verbosity'],
     )
@@ -89,4 +96,5 @@ verbose = {verbose}
         f.seek(0)
         verify([f.name] + ctx.args)
         click.echo("You may want to delete `{}' after the experiments are "
-                   "finished running.".format(f.name))
+                    "finished running.".format(f.name))
+
-- 
GitLab