* Find the smali file for a given class name. * Class name format: "com.example.MainActivity"
(projectDir: string, className: string)
| 452 | * Class name format: "com.example.MainActivity" |
| 453 | */ |
| 454 | function findSmaliFile(projectDir: string, className: string): string | null { |
| 455 | const relativePath = className.replace(/\./g, "/") + ".smali"; |
| 456 | |
| 457 | // Check smali, smali_classes2, smali_classes3, etc. |
| 458 | const entries = fs.readdirSync(projectDir); |
| 459 | const smaliDirs = entries.filter((e) => e.startsWith("smali")).sort(); |
| 460 | |
| 461 | for (const dir of smaliDirs) { |
| 462 | const candidate = path.join(projectDir, dir, relativePath); |
| 463 | if (fs.existsSync(candidate)) { |
| 464 | return candidate; |
| 465 | } |
| 466 | } |
| 467 | return null; |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * Generate a random plausible-looking Android library name. |
no outgoing calls
no test coverage detected