cm: extract_utils: Rewrite file existence checks

Change-Id: I7c1584ec7162e0e18fae471e6aceef6123a5d10b
This commit is contained in:
Bruno Martins 2016-07-27 15:00:05 +01:00 committed by Steve Kondik
parent b7b7f88443
commit 3b96ba5841
1 changed files with 10 additions and 12 deletions

View File

@ -500,11 +500,18 @@ function _adb_connected {
}; };
# #
# 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() { function parse_file_list() {
if [ ! -e "$1" ]; then if [ -z "$1" ]; then
echo "$1 does not exist!" echo "An input file is expected!"
exit 1
elif [ ! -f "$1" ]; then
echo "Input file "$1" does not exist!"
exit 1 exit 1
fi fi
@ -534,10 +541,6 @@ function parse_file_list() {
# the product makefile. # the product makefile.
# #
function write_makefiles() { function write_makefiles() {
if [ ! -e "$1" ]; then
echo "$1 does not exist!"
exit 1
fi
parse_file_list "$1" parse_file_list "$1"
write_product_copy_files write_product_copy_files
write_product_packages write_product_packages
@ -580,11 +583,6 @@ function init_adb_connection() {
# $2: path to extracted system folder, or "adb" to extract from device # $2: path to extracted system folder, or "adb" to extract from device
# #
function extract() { function extract() {
if [ ! -e "$1" ]; then
echo "$1 does not exist!"
exit 1
fi
if [ -z "$OUTDIR" ]; then if [ -z "$OUTDIR" ]; then
echo "Output dir not set!" echo "Output dir not set!"
exit 1 exit 1