From b859adc08f2e45f8da3c07eacf58aafcbc0e7a36 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Wed, 30 Nov 2016 09:28:34 +0100 Subject: [PATCH] Bug 20670 - abipkgdiff aborts if $XDG_CACHE_HOME does not exist 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 --- tools/abipkgdiff.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc index 6200c1a8..4060f01e 100644 --- a/tools/abipkgdiff.cc +++ b/tools/abipkgdiff.cc @@ -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";