Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
Fix download and home
Browse files Browse the repository at this point in the history
  • Loading branch information
thez3ro committed Feb 12, 2015
1 parent 6178b6c commit 1413b03
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions apk2java.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
sign_file=''
home=os.path.dirname(os.path.realpath(sys.argv[0]))
tmp='/tmp/apk2java/'
external="https://github.com/TheZ3ro/apk2java-linux/archive/master.zip"
external="https://github.com/TheZ3ro/apk2java-linux/releases/download/tool/tool.zip"

def check_home(path):
return os.path.isdir(path+"/tool")

def getunzipped(theurl, thedir, report):
print "Downloading external tool..."
print "Downloading external tool... -> "+thedir+"/tool/"
name = os.path.join(thedir, 'temp.zip')
try:
name, hdrs = urllib.urlretrieve(theurl, name, report)
Expand All @@ -46,10 +46,11 @@ def getunzipped(theurl, thedir, report):
fd.close()
z.close()
os.unlink(name)
print ""

def report(blocknr, blocksize, size):
current = blocknr*blocksize
sys.stdout.write("\rProgress: {0:.2f}%".format(100.0*current/size))
sys.stdout.write("\rProgress: {0:.2f}%".format(100.0*current/size)+" - {0:.1f} MB".format(current/1024/1024)+"/{0:.1f} MB".format(size/1024/1024))

def apktool(smali):
print "*********************************************"
Expand Down Expand Up @@ -131,11 +132,12 @@ def main():
if check_home(home) == False:
getunzipped(external, home, report)
else:
if check_home(home) == False and check_home("/opt/apk2java") == False:
getunzipped(external, "/opt/apk2java", report)
home = "/opt/apk2java"

exit(0)
if check_home(home) == False:
if check_home("/opt/apk2java") == False:
getunzipped(external, "/opt/apk2java", report)
home = "/opt/apk2java"
else:
home = "/opt/apk2java"

if (options.smali+options.jasmin+options.nosc) > 1:
print "[ ERROR ] You can only select 1 source format --[smali/jasmin/java/no-source]"
Expand Down

0 comments on commit 1413b03

Please sign in to comment.