(appPath: string)
| 290 | } |
| 291 | |
| 292 | async function getBundleNames(appPath: string): Promise<string[]> { |
| 293 | const fileName = path.basename(appPath, '.app') |
| 294 | |
| 295 | try { |
| 296 | const data: any = await new Promise((resolve, reject) => { |
| 297 | const plistPath = path.join(appPath, 'Contents', 'Info.plist') |
| 298 | plist.readFile(plistPath, (err: any, result: any) => { |
| 299 | if (err) reject(err) |
| 300 | else resolve(result) |
| 301 | }) |
| 302 | }) |
| 303 | |
| 304 | return uniqueNonEmpty([data?.CFBundleDisplayName, data?.CFBundleName, fileName]) |
| 305 | } catch { |
| 306 | return uniqueNonEmpty([fileName]) |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | // 获取应用显示名称(优先本地化名称,无需子进程) |
| 311 | async function getAppDisplayInfo(appPath: string): Promise<LocalizedAppMetadata> { |
no test coverage detected