From eeae3fea8aa1d5fbe76b03da3f7be136c11c73de Mon Sep 17 00:00:00 2001 From: terasum Date: Tue, 19 Sep 2023 20:11:16 +0800 Subject: [PATCH] fix: default config template wrong key --- internal/{entry => config}/config_tmpl.go | 6 +++--- internal/entry/app_loader.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename internal/{entry => config}/config_tmpl.go (91%) diff --git a/internal/entry/config_tmpl.go b/internal/config/config_tmpl.go similarity index 91% rename from internal/entry/config_tmpl.go rename to internal/config/config_tmpl.go index 2d69e474..009429ba 100644 --- a/internal/entry/config_tmpl.go +++ b/internal/config/config_tmpl.go @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -package entry +package config -const configTmpl = ` -DictBaseDir="$HOME/dicts" +const ConfigTmpl = ` +BaseDictDir="$HOME/dicts" ` diff --git a/internal/entry/app_loader.go b/internal/entry/app_loader.go index ab7b2f92..1a8609b3 100644 --- a/internal/entry/app_loader.go +++ b/internal/entry/app_loader.go @@ -41,7 +41,7 @@ func defaultConfigPath() (string, error) { } configFile := filepath.Join(home, "medict.toml") if _, err = os.Stat(configFile); errors.Is(err, os.ErrNotExist) { - err = os.WriteFile(configFile, []byte(configTmpl), 0644) + err = os.WriteFile(configFile, []byte(config.ConfigTmpl), 0644) if err != nil { return "", err }