[Pkg-libvirt-commits] [libguestfs] 12/26: builder: add functions to read XDG_CONFIG_DIRS and XDG_CONFIG_PATH

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 2 13:37:37 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag upstream/1.25.39
in repository libguestfs.

commit a21da3c8013e2658b41de962c4fb98df3c8896e4
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Tue Feb 25 17:29:08 2014 +0100

    builder: add functions to read XDG_CONFIG_DIRS and XDG_CONFIG_PATH
---
 builder/paths.ml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/builder/paths.ml b/builder/paths.ml
index 66e8922..e4f0c7b 100644
--- a/builder/paths.ml
+++ b/builder/paths.ml
@@ -24,3 +24,18 @@ let xdg_cache_home =
     try Some (Sys.getenv "HOME" // ".cache" // "virt-builder")
     with Not_found ->
       None (* no cache directory *)
+
+let xdg_config_home ~prog =
+  try Some (Sys.getenv "XDG_CONFIG_HOME" // prog)
+  with Not_found ->
+    try Some (Sys.getenv "HOME" // ".config" // prog)
+    with Not_found ->
+      None (* no config directory *)
+
+let xdg_config_dirs ~prog =
+  let dirs =
+    try Sys.getenv "XDG_CONFIG_DIRS"
+    with Not_found -> "/etc/xdg" in
+  let dirs = string_nsplit ":" dirs in
+  let dirs = List.filter (fun x -> x <> "") dirs in
+  List.map (fun x -> x // prog) dirs

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list