MCPcopy
hub / github.com/APKLab/APKLab / getApkNameFromApkToolYaml

Function getApkNameFromApkToolYaml

src/tools/apktool.ts:20–40  ·  view source on GitHub ↗
(apktoolYamlPath: string)

Source from the content-addressed store, hash-verified

18 * @returns returns the original apk file name or empty string.
19 */
20 export function getApkNameFromApkToolYaml(apktoolYamlPath: string): string {
21 if (!apktoolYamlPath || !fs.existsSync(apktoolYamlPath)) {
22 outputChannel.appendLine(
23 `Error: apktool.yml file not found at: ${apktoolYamlPath}`,
24 );
25 return "";
26 }
27
28 try {
29 const fileContent = fs.readFileSync(apktoolYamlPath, "utf8");
30 const regArr = /apkFileName: .*\.apk/.exec(fileContent);
31 return regArr && regArr.length > 0 ? regArr[0].split(": ")[1] : "";
32 } catch (err) {
33 const errorMessage =
34 err instanceof Error ? err.message : String(err);
35 outputChannel.appendLine(
36 `Couldn't find apkFileName in apktool.yml: ${errorMessage}`,
37 );
38 return "";
39 }
40 }
41
42 /**
43 * Decodes(Disassembles) the apk resources & dalvik bytecode using **Apktool**.

Callers 1

rebuildAPKFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected