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




commit b390c788dd3ff7b2c32fe04d39e3d66c2f148fba
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 | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gidocgen/utils.py b/gidocgen/utils.py
index 6ccc984..ad538a5 100644
--- a/gidocgen/utils.py
+++ b/gidocgen/utils.py
@@ -868,3 +868,12 @@ 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


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