Spaces:
Runtime error
Runtime error
| /** | |
| * TIA-∞ Ecosystem Scanner | |
| * Walks the QGTNL directory, maps structure, identifies modules, | |
| * and prepares a non-destructive report for Guided Builder mode. | |
| */ | |
| import * as fs from "fs"; | |
| import * as path from "path"; | |
| export interface ScanResult { | |
| path: string; | |
| type: "file" | "directory"; | |
| size: number; | |
| children?: ScanResult[]; | |
| } | |
| export function scanDirectory(targetPath: string): ScanResult { | |
| const stats = fs.statSync(targetPath); | |
| if (stats.isFile()) { | |
| return { | |
| path: targetPath, | |
| type: "file", | |
| size: stats.size, | |
| }; | |
| } | |
| const children = fs.readdirSync(targetPath).map((child) => { | |
| const childPath = path.join(targetPath, child); | |
| return scanDirectory(childPath); | |
| }); | |
| return { | |
| path: targetPath, | |
| type: "directory", | |
| size: stats.size, | |
| children, | |
| }; | |
| } | |
| export function scanQGTNL() { | |
| const root = "/data/data/com.termux/files/home/QGTNL"; | |
| if (!fs.existsSync(root)) { | |
| return { | |
| status: "error", | |
| message: "QGTNL root not found.", | |
| }; | |
| } | |
| const structure = scanDirectory(root); | |
| return { | |
| status: "ok", | |
| scannedAt: Date.now(), | |
| structure, | |
| }; | |
| } | |