123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- //
- // ZGApkToolPath.m
- // UUTUtils
- //
- // Created by zhuge on 2017/12/27.
- // Copyright © 2017年 zhuge. All rights reserved.
- //
- #import "ZGApkToolPath.h"
- #import "ZGShellUtils.h"
- @implementation ZGApkToolPath
- + (ZGApkToolPath *)shared {
- static dispatch_once_t pred;
- static ZGApkToolPath *shared = nil;
- dispatch_once(&pred, ^{
- shared = [[ZGApkToolPath alloc] init];
- });
- return shared;
- }
- - (instancetype)init
- {
- self = [super init];
- if (self) {
- NSBundle *bundle = [NSBundle mainBundle];
- self.key = [bundle pathForResource:@"ApkTools/keyer/key.sh" ofType:nil];
- self.key_in = [bundle pathForResource:@"ApkTools/keyer/key_in.sh" ofType:nil];
- self.apktool = [bundle pathForResource:@"ApkTools/apktool" ofType:nil];
- self.sign_in = [bundle pathForResource:@"ApkTools/signer/sign_in" ofType:@"sh"];
- self.align = [bundle pathForResource:@"ApkTools/zipalign" ofType:nil];
- self.adb = [bundle pathForResource:@"ApkTools/adb" ofType:nil];
-
- [ZGShellUtils makeFileExecutable:self.key];
- [ZGShellUtils makeFileExecutable:self.key_in];
- [ZGShellUtils makeFileExecutable:self.sign_in];
- [ZGShellUtils makeFileExecutable:self.align];
- [ZGShellUtils makeFileExecutable:self.adb];
- [ZGShellUtils makeFileExecutable:self.apktool];
-
- NSString *aapt = [bundle pathForResource:@"ApkTools/aapt" ofType:nil];
- [ZGShellUtils makeFileExecutable:aapt];
- }
- return self;
- }
- @end
|