(key: string)
| 1069 | } |
| 1070 | |
| 1071 | export function rawSettingsContainsKey(key: string): boolean { |
| 1072 | for (const source of getEnabledSettingSources()) { |
| 1073 | // Skip policySettings - we only care about user-configured settings |
| 1074 | if (source === 'policySettings') { |
| 1075 | continue |
| 1076 | } |
| 1077 | |
| 1078 | const filePath = getSettingsFilePathForSource(source) |
| 1079 | if (!filePath) { |
| 1080 | continue |
| 1081 | } |
| 1082 | |
| 1083 | try { |
| 1084 | const { resolvedPath } = safeResolvePath(getFsImplementation(), filePath) |
| 1085 | const content = readFileSync(resolvedPath) |
| 1086 | if (!content.trim()) { |
| 1087 | continue |
| 1088 | } |
| 1089 | |
| 1090 | const rawData = safeParseJSON(content, false) |
| 1091 | if (rawData && typeof rawData === 'object' && key in rawData) { |
| 1092 | return true |
| 1093 | } |
| 1094 | } catch (error) { |
| 1095 | // File not found is expected - not all settings files exist |
| 1096 | // Other errors (permissions, I/O) should be tracked |
| 1097 | handleFileSystemError(error, filePath) |
| 1098 | } |
| 1099 | } |
| 1100 | |
| 1101 | return false |
| 1102 | } |
no test coverage detected