diff --git a/pkg/client/config.go b/pkg/client/config.go index b0d7ba48f..276ee46e6 100644 --- a/pkg/client/config.go +++ b/pkg/client/config.go @@ -28,6 +28,7 @@ import ( "camlistore.org/pkg/auth" "camlistore.org/pkg/blob" + "camlistore.org/pkg/buildinfo" "camlistore.org/pkg/client/android" "camlistore.org/pkg/jsonconfig" "camlistore.org/pkg/jsonsign" @@ -46,7 +47,10 @@ var ( ) func AddFlags() { - defaultPath := osutil.UserClientConfigPath() + defaultPath := "/x/y/z/we're/in-a-test" + if !buildinfo.TestingLinked() { + defaultPath = osutil.UserClientConfigPath() + } flag.StringVar(&flagServer, "server", "", "Camlistore server prefix. If blank, the default from the \"server\" field of "+defaultPath+" is used. Acceptable forms: https://you.example.com, example.com:1345 (https assumed), or http://you.example.com/alt-root") flag.StringVar(&flagSecretRing, "secret-keyring", "", "GnuPG secret keyring file to use.") } @@ -442,12 +446,11 @@ var osutilHomeDir = osutil.HomeDir // changed by tests func newIgnoreChecker(ignoredFiles []string) func(path string) (shouldIgnore bool) { var fns []func(string) bool - home := osutilHomeDir() // copy of ignoredFiles for us to mutate ignFiles := append([]string(nil), ignoredFiles...) for k, v := range ignFiles { if strings.HasPrefix(v, filepath.FromSlash("~/")) { - ignFiles[k] = filepath.Join(home, v[2:]) + ignFiles[k] = filepath.Join(osutilHomeDir(), v[2:]) } } // We cache the ignoredFiles patterns in 3 categories (not necessarily exclusive):