[Fuego] [PATCH] functions: add is_abs_path
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Wed Oct 31 01:42:22 UTC 2018
this function checks if a path is absolute or relative
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/functions.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/engine/scripts/functions.sh b/engine/scripts/functions.sh
index a2df8fc..241ba0d 100755
--- a/engine/scripts/functions.sh
+++ b/engine/scripts/functions.sh
@@ -1003,3 +1003,14 @@ function assert_has_program {
is_on_target_path $1 ${progVar}
assert_define ${progVar} "Missing '$1' program on target board"
}
+
+# check if the path is an absolute path or a relative path
+# $1 - the path to check
+function is_abs_path {
+ if [ ${1:0:1} == "/" ]; then
+ # absolute path because it starts with "/"
+ return 0
+ else
+ return 1
+ fi
+}
--
2.7.4
More information about the Fuego
mailing list