registriesDirPathWithHomeDir is an internal implementation detail of registriesDirPath, it exists only to allow testing it with an artificial home directory.
(sys *types.SystemContext, homeDir string)
| 91 | // registriesDirPathWithHomeDir is an internal implementation detail of registriesDirPath, |
| 92 | // it exists only to allow testing it with an artificial home directory. |
| 93 | func registriesDirPathWithHomeDir(sys *types.SystemContext, homeDir string) string { |
| 94 | if sys != nil && sys.RegistriesDirPath != "" { |
| 95 | return sys.RegistriesDirPath |
| 96 | } |
| 97 | userRegistriesDirPath := filepath.Join(homeDir, userRegistriesDir) |
| 98 | if err := fileutils.Exists(userRegistriesDirPath); err == nil { |
| 99 | return userRegistriesDirPath |
| 100 | } |
| 101 | if sys != nil && sys.RootForImplicitAbsolutePaths != "" { |
| 102 | return filepath.Join(sys.RootForImplicitAbsolutePaths, systemRegistriesDirPath) |
| 103 | } |
| 104 | |
| 105 | return systemRegistriesDirPath |
| 106 | } |
| 107 | |
| 108 | // loadAndMergeConfig loads configuration files in dirPath |
| 109 | // FIXME: Probably rename to loadRegistryConfigurationForPath |
no outgoing calls
searching dependent graphs…