MCPcopy Create free account
hub / github.com/Noumena-Network/code / getSettingsRootPathForSource

Function getSettingsRootPathForSource

src/utils/settings/settings.ts:245–265  ·  view source on GitHub ↗
(source: SettingSource)

Source from the content-addressed store, hash-verified

243 * @returns The root path of the settings file
244 */
245export function getSettingsRootPathForSource(source: SettingSource): string {
246 switch (source) {
247 case 'userSettings': {
248 const filePath =
249 getSettingsFilePathForSource(source) ??
250 getSettingsWriteFilePathForSource(source)
251 return filePath
252 ? dirname(resolve(filePath))
253 : resolve(getCanonicalNcodeConfigHomeDir())
254 }
255 case 'policySettings':
256 case 'projectSettings':
257 case 'localSettings': {
258 return resolve(getOriginalCwd())
259 }
260 case 'flagSettings': {
261 const path = getFlagSettingsPath()
262 return path ? dirname(resolve(path)) : resolve(getOriginalCwd())
263 }
264 }
265}
266
267/**
268 * Get the user settings filename based on cowork mode.

Callers 3

rootPathForSourceFunction · 0.85

Calls 5

getOriginalCwdFunction · 0.85
getFlagSettingsPathFunction · 0.85
resolveFunction · 0.50

Tested by

no test coverage detected