* Find the APKTool project root by walking up from the given directory.
(startPath: string)
| 29 | * Find the APKTool project root by walking up from the given directory. |
| 30 | */ |
| 31 | function findApktoolProjectRoot(startPath: string): string | null { |
| 32 | let dir = startPath; |
| 33 | for (let i = 0; i < 10; i++) { |
| 34 | if (fs.existsSync(path.join(dir, APKTOOL_YML_FILENAME))) { |
| 35 | return dir; |
| 36 | } |
| 37 | const parent = path.dirname(dir); |
| 38 | if (parent === dir) break; |
| 39 | dir = parent; |
| 40 | } |
| 41 | return null; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Resolve the path to smali-lsp server JAR from user config. |