[gi-docgen/wip/carlosg/multi-content-dir: 1/5] utils: Add helper method to lookup an extra content file




commit 44a9cb28ccbc608f8c2b83d9aa6b06e6e1c88024
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jun 6 00:22:39 2021 +0200

    utils: Add helper method to lookup an extra content file
    
    It will be useful to add multiple content dirs (e.g. when mixing
    static files in the source tree with generated files). Add this
    helper function to look up a content file in the given content
    dirs.

 gidocgen/utils.py | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gidocgen/utils.py b/gidocgen/utils.py
index 6ccc984..24ab2a7 100644
--- a/gidocgen/utils.py
+++ b/gidocgen/utils.py
@@ -868,3 +868,11 @@ def default_search_paths():
         paths.extend([os.path.join(x, "gir-1.0") for x in xdg_data_dirs])
 
     return paths
+
+def find_extra_content_file(content_dirs, file):
+    for p in content_dirs:
+        full_path = os.path.join(p, file)
+        if os.path.isfile(full_path):
+            return full_path
+
+    return None
\ No newline at end of file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]