Meta: Add cross-platform function for absolutizing paths

This commit is contained in:
Tim Ledbetter 2024-10-29 08:45:59 +00:00 committed by Tim Flynn
parent 8132587b3b
commit cd0b9c4ec0
Notes: github-actions[bot] 2024-10-29 11:31:33 +00:00

View file

@ -83,3 +83,14 @@ get_build_dir() {
echo "${BUILD_DIR}"
}
absolutize_path() {
directory="$(eval echo "$(dirname "$1")")"
if [ -d "$directory" ]; then
resolved_directory="$(cd "$directory" && pwd)"
echo "${resolved_directory%/}/$(basename "$1")"
else
echo "No such directory: '$directory'" >&2
return 1
fi
}