cm: extract_utils: Rewrite file existence checks
Change-Id: I7c1584ec7162e0e18fae471e6aceef6123a5d10b
diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh
index 2603203..8cd2caf 100644
--- a/build/tools/extract_utils.sh
+++ b/build/tools/extract_utils.sh
@@ -500,11 +500,18 @@
};
#
-# parse_file_list
+# parse_file_list:
+#
+# $1: input file
+#
+# Sets PRODUCT_PACKAGES and PRODUCT_COPY_FILES while parsing the input file
#
function parse_file_list() {
- if [ ! -e "$1" ]; then
- echo "$1 does not exist!"
+ if [ -z "$1" ]; then
+ echo "An input file is expected!"
+ exit 1
+ elif [ ! -f "$1" ]; then
+ echo "Input file "$1" does not exist!"
exit 1
fi
@@ -534,10 +541,6 @@
# the product makefile.
#
function write_makefiles() {
- if [ ! -e "$1" ]; then
- echo "$1 does not exist!"
- exit 1
- fi
parse_file_list "$1"
write_product_copy_files
write_product_packages
@@ -580,11 +583,6 @@
# $2: path to extracted system folder, or "adb" to extract from device
#
function extract() {
- if [ ! -e "$1" ]; then
- echo "$1 does not exist!"
- exit 1
- fi
-
if [ -z "$OUTDIR" ]; then
echo "Output dir not set!"
exit 1