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

Function parseUrlFile

src/main/core/commandScanner/windowsScanner.ts:176–203  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

174}
175
176export async function parseUrlFile(filePath: string): Promise<UrlFileInfo | null> {
177 try {
178 const content = await fsPromises.readFile(filePath, 'utf-8')
179 let url = ''
180 let iconFile = ''
181
182 for (const line of content.split('\n')) {
183 const trimmed = line.trim()
184 if (trimmed.startsWith('URL=')) {
185 url = trimmed.slice(4)
186 } else if (trimmed.startsWith('IconFile=')) {
187 iconFile = trimmed.slice(9)
188 }
189 }
190
191 if (!url) return null
192
193 // 跳过普通网页链接(http/https),保留其他应用协议(如 steam://)
194 const lowerUrl = url.toLowerCase()
195 if (lowerUrl.startsWith('http://') || lowerUrl.startsWith('https://')) {
196 return null
197 }
198
199 return { url, iconFile }
200 } catch {
201 return null
202 }
203}
204
205// 递归扫描目录中的快捷方式
206async function scanDirectory(

Callers 2

scanDirectoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected