Skip to content

Commit

Permalink
Pull request fixes issues #1 and Issue #2
Browse files Browse the repository at this point in the history
* Fixes #1 Exits if file doesn't exist
* Fixes #2. Print help if no argument given.

The script now checks for number of arguments given by user and prints help, if the number is 0.

* Fixes #1. Exits if file does not exist.
  • Loading branch information
c0dist authored and anantshri committed Jun 2, 2016
1 parent c821afe commit 62420cb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apk2java
Expand Up @@ -7,7 +7,7 @@ echo "This is a script created by Anant Shrivastava"
echo "http://anantshri.info"
echo "Designed and Tested on Android Tamer"
echo "This script will work on automating the work of extracting the source code out from the apk file"
if [ $1 == "--help" -o $1 == "-help" ]
if [[ $# -eq 0 || $1 == "--help" || $1 == "-help" ]]
then
echo ""
echo "$0 APK_FILE_NAME"
Expand Down Expand Up @@ -36,6 +36,14 @@ then
echo "Only APK's allowed"
exit
fi

#Checks if the file exists.
if [ ! -f "$FULL_PTH" ]
then
echo "File not found."
exit
fi

echo "Creating Output Directory"
mkdir -p "$SRC_DIR"
ls -l
Expand Down Expand Up @@ -68,4 +76,4 @@ then
fi
ls -l "$SRC_DIR"
cd "$CDIR"
echo "All Done"
echo "All Done"

0 comments on commit 62420cb

Please sign in to comment.