mirror of https://github.com/knative/client.git
fix: Fix default config path on Windows (#752)
This commit is contained in:
parent
5e73d8dad3
commit
a0a762b87e
|
|
@ -30,6 +30,10 @@
|
|||
| Fix plugin execution for Windows.
|
||||
| https://github.com/knative/client/pull/738[#738]
|
||||
|
||||
| 🐛
|
||||
| Fix default config path on Windows
|
||||
| https://github.com/knative/client/pull/751[#751]
|
||||
|
||||
## v0.13.0 (2020-03-11)
|
||||
|
||||
[cols="1,10,3", options="header", width="100%"]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"k8s.io/client-go/dynamic"
|
||||
"k8s.io/client-go/rest"
|
||||
|
|
@ -41,8 +42,8 @@ var CfgFile string
|
|||
|
||||
// Cfg is Kn's configuration values
|
||||
var Cfg Config = Config{
|
||||
DefaultConfigDir: "~/.config/kn",
|
||||
DefaultPluginDir: "~/.config/kn/plugins",
|
||||
DefaultConfigDir: newDefaultConfigPath(""),
|
||||
DefaultPluginDir: newDefaultConfigPath("plugins"),
|
||||
PluginsDir: "",
|
||||
LookupPlugins: newBoolP(false),
|
||||
}
|
||||
|
|
@ -195,3 +196,11 @@ func newBoolP(b bool) *bool {
|
|||
aBool := b
|
||||
return &aBool
|
||||
}
|
||||
|
||||
// Returns default config path based on target OS
|
||||
func newDefaultConfigPath(subDir string) string {
|
||||
if runtime.GOOS == "windows" {
|
||||
return filepath.Join(os.Getenv("APPDATA"), "kn", subDir)
|
||||
}
|
||||
return filepath.Join("~", ".config", "kn", subDir)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue