Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src/lib/cache.sh
blob: 24056facf08b6deb9b99621db2a73ee6382a2c83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/hint/bash
#
# SPDX-License-Identifier: GPL-3.0-or-later

[[ -z ${DEVTOOLS_INCLUDE_CACHE_SH:-} ]] || return 0
DEVTOOLS_INCLUDE_CACHE_SH=1

set -e

readonly XDG_DEVTOOLS_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/devtools"

get_cache_file() {
	local filename=$1
	local path="${XDG_DEVTOOLS_CACHE_DIR}/${filename}"

	mkdir --parents -- "$(dirname -- "$path")"
	if [[ ! -f ${path} ]]; then
		touch -- "${path}"
	fi

	printf '%s' "${path}"
}