Codebase list cmseek / 28dec9e debian / patches / fix-report-dir-creation.patch
28dec9e

Tree @28dec9e (Download .tar.gz)

fix-report-dir-creation.patch @28dec9eraw · history · blame

From: Sophie Brun <[email protected]>
Date: Wed, 4 Nov 2020 17:48:40 +0100
Subject: Fix Report directory creation

Last-Update: 2020-11-04

By default if dir of cmseek.py (ie /usr/share/cmseek) is not writable,
csmeek will use the current directory to keep Result... But if the
directory Result doesn't exist, cmseek display an error but il will
create it later if you continue. So create the Result directory before.
---
 cmseekdb/createindex.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/cmseekdb/createindex.py b/cmseekdb/createindex.py
index b4b425b..4f846a2 100644
--- a/cmseekdb/createindex.py
+++ b/cmseekdb/createindex.py
@@ -22,6 +22,9 @@ def init(cmseek_dir, report_dir=""):
         index_file = os.path.join(cmseek_dir, 'reports.json')
         if report_dir == "":
             report_dir = os.path.join(cmseek_dir, 'Result')
+        if not os.path.exists(report_dir):
+            cmseek.info('Creating Result directory in current directory')
+            os.makedirs(report_dir)
         if os.path.isdir(report_dir):
             result_index = {}
             result_dirs = os.listdir(report_dir)