MCPcopy Create free account
hub / github.com/ZToolsCenter/ZTools / getBundleNames

Function getBundleNames

src/main/core/commandScanner/macScanner.ts:292–308  ·  view source on GitHub ↗
(appPath: string)

Source from the content-addressed store, hash-verified

290}
291
292async 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// 获取应用显示名称(优先本地化名称,无需子进程)
311async function getAppDisplayInfo(appPath: string): Promise<LocalizedAppMetadata> {

Callers 1

getAppDisplayInfoFunction · 0.85

Calls 1

uniqueNonEmptyFunction · 0.85

Tested by

no test coverage detected