MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / resolveJetBrainsLafPaths

Function resolveJetBrainsLafPaths

cli/src/utils/theme-system.ts:236–284  ·  view source on GitHub ↗
(
  env: CliEnv = getCliEnv(),
)

Source from the content-addressed store, hash-verified

234}
235
236const resolveJetBrainsLafPaths = (
237 env: CliEnv = getCliEnv(),
238): string[] => {
239 const candidates: string[] = []
240
241 // Check IDE config dirs
242 if (env.IDE_CONFIG_DIR) {
243 candidates.push(join(env.IDE_CONFIG_DIR, 'options', 'laf.xml'))
244 }
245 if (env.JB_IDE_CONFIG_DIR) {
246 candidates.push(join(env.JB_IDE_CONFIG_DIR, 'options', 'laf.xml'))
247 }
248
249 const home = homedir()
250
251 const baseDirs: string[] = []
252 if (process.platform === 'darwin') {
253 baseDirs.push(join(home, 'Library', 'Application Support', 'JetBrains'))
254 } else if (process.platform === 'win32') {
255 const appData = env.APPDATA
256 if (appData) {
257 baseDirs.push(join(appData, 'JetBrains'))
258 }
259 } else {
260 baseDirs.push(join(home, '.config', 'JetBrains'))
261 baseDirs.push(join(home, '.local', 'share', 'JetBrains'))
262 }
263
264 for (const base of baseDirs) {
265 try {
266 if (!existsSync(base)) continue
267 const entries = readdirSync(base)
268 for (const entry of entries) {
269 const dirPath = join(base, entry)
270 try {
271 if (!statSync(dirPath).isDirectory()) continue
272 } catch {
273 continue
274 }
275
276 candidates.push(join(dirPath, 'options', 'laf.xml'))
277 }
278 } catch {
279 // Ignore unreadable directories
280 }
281 }
282
283 return candidates
284}
285
286const resolveZedSettingsPaths = (
287 env: CliEnv = getCliEnv(),

Callers 3

detectJetBrainsThemeFunction · 0.85
getIDEThemeConfigPathsFunction · 0.85
setupFileWatchersFunction · 0.85

Calls 1

getCliEnvFunction · 0.90

Tested by

no test coverage detected