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.
|
| Fix plugin execution for Windows.
|
||||||
| https://github.com/knative/client/pull/738[#738]
|
| 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)
|
## v0.13.0 (2020-03-11)
|
||||||
|
|
||||||
[cols="1,10,3", options="header", width="100%"]
|
[cols="1,10,3", options="header", width="100%"]
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"k8s.io/client-go/dynamic"
|
"k8s.io/client-go/dynamic"
|
||||||
"k8s.io/client-go/rest"
|
"k8s.io/client-go/rest"
|
||||||
|
|
@ -41,8 +42,8 @@ var CfgFile string
|
||||||
|
|
||||||
// Cfg is Kn's configuration values
|
// Cfg is Kn's configuration values
|
||||||
var Cfg Config = Config{
|
var Cfg Config = Config{
|
||||||
DefaultConfigDir: "~/.config/kn",
|
DefaultConfigDir: newDefaultConfigPath(""),
|
||||||
DefaultPluginDir: "~/.config/kn/plugins",
|
DefaultPluginDir: newDefaultConfigPath("plugins"),
|
||||||
PluginsDir: "",
|
PluginsDir: "",
|
||||||
LookupPlugins: newBoolP(false),
|
LookupPlugins: newBoolP(false),
|
||||||
}
|
}
|
||||||
|
|
@ -195,3 +196,11 @@ func newBoolP(b bool) *bool {
|
||||||
aBool := b
|
aBool := b
|
||||||
return &aBool
|
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