From 64196fe6ad559c6803158cfa84bfa6001b0f83ab Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 28 Apr 2022 20:10:43 +0200 Subject: [PATCH] fix: override config on init resolves #2180 --- .vscode/launch.json | 2 +- src/environment/shell.go | 21 +-------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7b02e1c7..239e746c 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "prompt", "print", "primary", - "--config=${workspaceRoot}/themes/cinnamon.omp.json", + "--config=https://gist.githubusercontent.com/ehawman-rosenberg/50b3b695526f03690cfd396d02c2cca3/raw/c2e0bc78cdf551b0cc76f593e4fd70428f981c0e/eh-tea.omp.json", "--shell=pwsh", "--terminal-width=200", ] diff --git a/src/environment/shell.go b/src/environment/shell.go index c802ab83..1003405b 100644 --- a/src/environment/shell.go +++ b/src/environment/shell.go @@ -257,26 +257,7 @@ func (env *ShellEnvironment) resolveConfigPath() { } func (env *ShellEnvironment) downloadConfig(location string) error { - configFileName := fmt.Sprintf("%s.omp.json", env.Version) - configPath := filepath.Join(env.CachePath(), configFileName) - if env.HasFilesInDir(env.CachePath(), configFileName) { - env.CmdFlags.Config = configPath - return nil - } - // clean old config files - cleanCacheDir := func() { - dir, err := ioutil.ReadDir(env.CachePath()) - if err != nil { - return - } - for _, file := range dir { - if strings.HasSuffix(file.Name(), ".omp.json") { - os.Remove(filepath.Join(env.CachePath(), file.Name())) - } - } - } - cleanCacheDir() - + configPath := filepath.Join(env.CachePath(), "config.omp.json") cfg, err := env.HTTPRequest(location, 5000) if err != nil { return err