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

Function scanDesktopDir

src/main/core/commandScanner/linuxScanner.ts:236–245  ·  view source on GitHub ↗

* 扫描单个目录下的所有 .desktop 文件

(dirPath: string)

Source from the content-addressed store, hash-verified

234 * 扫描单个目录下的所有 .desktop 文件
235 */
236async function scanDesktopDir(dirPath: string): Promise<string[]> {
237 try {
238 const entries = await fs.readdir(dirPath, { withFileTypes: true })
239 return entries
240 .filter((e) => e.isFile() && e.name.endsWith('.desktop'))
241 .map((e) => path.join(dirPath, e.name))
242 } catch {
243 return []
244 }
245}
246
247/**
248 * 将单个 .desktop 文件转换为 Command 对象

Callers 1

scanApplicationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected