diff options
author | merakor <cem@ckyln.com> | 2020-08-07 11:36:43 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-08-07 11:36:43 +0000 |
commit | 03ada986759549070f55bc6e80d34322f7260db3 (patch) | |
tree | c26892af8fb8ade4626132921373fa372036c9d6 | |
parent | fcad9cc30680eb397bdefaa90c2feb42d7547042 (diff) | |
download | cpt-03ada986759549070f55bc6e80d34322f7260db3.tar.gz |
cpt-lib: move non-temporary cache directory creation back to main()
FossilOrigin-Name: 5a7ee309fea6cb1f8b6b6ce9c1c1e5ee339061153123764a2637f86f6ef535b1
-rw-r--r-- | src/cpt-lib | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/cpt-lib b/src/cpt-lib index 9f28197..70cf547 100644 --- a/src/cpt-lib +++ b/src/cpt-lib @@ -1433,20 +1433,25 @@ create_cache() { # # Create the required temporary directories and set the variables # which point to them. - mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \ - "${CPT_TMPDIR:=$cac_dir}" \ + mkdir -p "${CPT_TMPDIR:=$cac_dir}" \ "${mak_dir:=$CPT_TMPDIR/build-$pid}" \ "${pkg_dir:=$CPT_TMPDIR/pkg-$pid}" \ "${tar_dir:=$CPT_TMPDIR/extract-$pid}" \ - "${src_dir:=$cac_dir/sources}" \ - "${log_dir:=$cac_dir/logs}" \ - "${bin_dir:=$cac_dir/bin}" } main() { set -ef + # Create the cache directories for CPT and set the variables which point + # to them. This is seperate from temporary directories created in + # create_cache(). That's because we need these variables set on most + # occasions. + mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \ + "${src_dir:=$cac_dir/sources}" \ + "${log_dir:=$cac_dir/logs}" \ + "${bin_dir:=$cac_dir/bin}" + # Die here if the user has no set CPT_PATH. This is a rare occurance # as the environment variable should always be defined. [ "$CPT_PATH" ] || die "\$CPT_PATH needs to be set" |