Revision 9246
Added by Aaron Marcuse-Kubitza over 11 years ago
lib/sh/util.sh | ||
---|---|---|
242 | 242 |
log++; kw_params base_dir path |
243 | 243 |
: "${base_dir:?}" "${path:?}" |
244 | 244 |
|
245 |
path="${path#$base_dir/}" # remove any prefix shared with base_dir |
|
245 |
local path="$path/" # add *extra* / to match path when exactly = base_dir |
|
246 |
path="${path#$base_dir/}" # remove prefix shared with base_dir |
|
247 |
path="${path%/}" # remove any remaining extra trailing / |
|
246 | 248 |
|
247 | 249 |
if test ! "$path"; then path=.; fi # ensure non-empty |
248 | 250 |
|
Also available in: Unified diff
lib/sh/util.sh: rel_path(): also remove base_dir when path exactly = to it. this involves adding and removing an extra trailing /.