From 15b90575dc6c7ad6f45a52cbb6a5be913418729d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Tue, 10 Jul 2018 13:08:38 +0300 Subject: support a dumb variable for root path / --- README.md | 2 ++ update.sh | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3b37c7e..3a96530 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ More precisely, the corresponding directory names must match the Consequently, `ProgramFiles(x86)` (and other weird variable names Windows allows) are not supported. +A special variable name `CONFIG_LINKS_ROOT` is resolved to the root path, "/". + License ------- diff --git a/update.sh b/update.sh index 77a48a1..3d64cb6 100755 --- a/update.sh +++ b/update.sh @@ -161,6 +161,11 @@ resolve_variable() { return 0 fi + if [ "$var_name" = "$root_var_name" ]; then + echo '' + return 0 + fi + if [ -z "${!var_name+x}" ]; then dump "variable is not set: $var_name" >&2 return 1 @@ -178,6 +183,7 @@ cache_variable() { done } +readonly root_var_name='CONFIG_LINKS_ROOT' readonly var_name_regex='%\([_[:alpha:]][_[:alnum:]]*\)%' extract_variable_name() { @@ -278,7 +284,7 @@ delete_obsolete_dirs() { return 1 fi - ( cd -- "$base_dir" && rmdir -p --ignore-fail-on-non-empty -- "$subpath" ) + ( cd -- "$base_dir/" && rmdir -p --ignore-fail-on-non-empty -- "$subpath" ) } delete_obsolete_entries() { -- cgit v1.2.3