| 43 | * included only when appropriate. |
| 44 | */ |
| 45 | export function getMacOSPlistPaths(): Array<{ path: string; label: string }> { |
| 46 | let username = '' |
| 47 | try { |
| 48 | username = userInfo().username |
| 49 | } catch { |
| 50 | // ignore |
| 51 | } |
| 52 | |
| 53 | const paths: Array<{ path: string; label: string }> = [] |
| 54 | |
| 55 | if (username) { |
| 56 | paths.push({ |
| 57 | path: `/Library/Managed Preferences/${username}/${MACOS_PREFERENCE_DOMAIN}.plist`, |
| 58 | label: 'per-user managed preferences', |
| 59 | }) |
| 60 | } |
| 61 | |
| 62 | paths.push({ |
| 63 | path: `/Library/Managed Preferences/${MACOS_PREFERENCE_DOMAIN}.plist`, |
| 64 | label: 'device-level managed preferences', |
| 65 | }) |
| 66 | |
| 67 | // Allow user-writable preferences for local MDM testing in ant builds only. |
| 68 | if (process.env.USER_TYPE === 'ant') { |
| 69 | paths.push({ |
| 70 | path: join( |
| 71 | homedir(), |
| 72 | 'Library', |
| 73 | 'Preferences', |
| 74 | `${MACOS_PREFERENCE_DOMAIN}.plist`, |
| 75 | ), |
| 76 | label: 'user preferences (ant-only)', |
| 77 | }) |
| 78 | } |
| 79 | |
| 80 | return paths |
| 81 | } |
| 82 | |