Bug 20670 - abipkgdiff aborts if $XDG_CACHE_HOME does not exist
authorDodji Seketeli <dodji@redhat.com>
Wed, 30 Nov 2016 08:28:34 +0000 (09:28 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 30 Nov 2016 09:40:01 +0000 (10:40 +0100)
This patch creates $XDG_CACHE_HOME if it doesn't exist, rather than
just aborting.

* tools/abipkgdiff.cc (package::extracted_packages_parent_dir):
Ensure that the cache directory is created, even when
XDG_CACHE_HOME is set.  Also, remove the now useless "using
abigail::tools_utils::get_random_number_as_string" statement.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tools/abipkgdiff.cc

index 6200c1a85bb6e3e3cff59f0d52800483e77d0905..4060f01e11e2685d6f43082c851d89a39844edb8 100644 (file)
@@ -564,12 +564,11 @@ package::extracted_packages_parent_dir()
          if (p.empty())
            p = "~";
          p += "/.cache/libabigail";
-         // Create directory $HOME/.cache/libabigail/ if it doesn't
-         // exist
-         bool cache_dir_is_created = ensure_dir_path_created(p);
-         assert(cache_dir_is_created);
         }
-      using abigail::tools_utils::get_random_number_as_string;
+
+      // Create the cache directory if it doesn't exist
+      bool cache_dir_is_created = ensure_dir_path_created(p);
+      assert(cache_dir_is_created);
 
       string libabigail_tmp_dir_template = p;
       libabigail_tmp_dir_template += "/abipkgdiff-tmp-dir-XXXXXX";