From 5ed5b3ac085c2450b04b8f463c73bad782609047 Mon Sep 17 00:00:00 2001
From: "benjamin.jakimow@geo.hu-berlin.de" <q8DTkxUg-BB>
Date: Fri, 20 Jan 2017 18:32:27 +0100
Subject: [PATCH] added findAbsolutePath(), which looks in some reasonable
 directories to resolve relative paths

---
 timeseriesviewer/__init__.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/timeseriesviewer/__init__.py b/timeseriesviewer/__init__.py
index be185bdc..a1a1e988 100644
--- a/timeseriesviewer/__init__.py
+++ b/timeseriesviewer/__init__.py
@@ -44,5 +44,15 @@ def file_search(rootdir, wildcard, recursive=False, ignoreCase=False):
                 results.append(os.path.join(root, file))
         if not recursive:
             break
+            pass
     return results
 
+
+def findAbsolutePath(file):
+    if os.path.exists(file): return file
+    possibleRoots = [DIR_EXAMPLES, DIR_REPO, os.getcwd()]
+    for root in possibleRoots:
+        tmp = jp(root, file)
+        if os.path.exists(tmp):
+            return tmp
+    return None
\ No newline at end of file
-- 
GitLab