From 915533b8c5e8695c78c48dd8eda2b3e9d796dd66 Mon Sep 17 00:00:00 2001 From: gitgiggety <79809426+gitgiggety@users.noreply.github.com> Date: Tue, 10 Aug 2021 06:58:14 +0200 Subject: [PATCH] Create default config directory during setup (#1623) * Create default config directory during setup Instead of creating the config directory during startup, create it during setup when needed. Fixes #1616 --- pkg/manager/manager.go | 9 ++++++++- ui/v2.5/src/components/Changelog/versions/v090.md | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 349851cc2..638332619 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -58,7 +58,6 @@ func GetInstance() *singleton { func Initialize() *singleton { once.Do(func() { - _ = utils.EnsureDir(paths.GetStashHomeDirectory()) cfg, err := config.Initialize() if err != nil { @@ -269,6 +268,14 @@ func setSetupDefaults(input *models.SetupInput) { func (s *singleton) Setup(input models.SetupInput) error { setSetupDefaults(&input) + // create the config directory if it does not exist + configDir := filepath.Dir(input.ConfigLocation) + if exists, _ := utils.DirExists(configDir); !exists { + if err := os.Mkdir(configDir, 0755); err != nil { + return fmt.Errorf("abc: %s", err.Error()) + } + } + // create the generated directory if it does not exist if exists, _ := utils.DirExists(input.GeneratedLocation); !exists { if err := os.Mkdir(input.GeneratedLocation, 0755); err != nil { diff --git a/ui/v2.5/src/components/Changelog/versions/v090.md b/ui/v2.5/src/components/Changelog/versions/v090.md index b2157a772..f4f3ea661 100644 --- a/ui/v2.5/src/components/Changelog/versions/v090.md +++ b/ui/v2.5/src/components/Changelog/versions/v090.md @@ -15,6 +15,7 @@ * Added de-DE language option. ([#1578](https://github.com/stashapp/stash/pull/1578)) ### 🐛 Bug fixes +* Create .stash directory in $HOME only if required. ([#1623](https://github.com/stashapp/stash/pull/1623)) * Include stash id when scraping performer from stash-box. ([#1608](https://github.com/stashapp/stash/pull/1608)) * Fix infinity framerate values causing resolver error. ([#1607](https://github.com/stashapp/stash/pull/1607)) * Fix unsetting performer gender not working correctly. ([#1606](https://github.com/stashapp/stash/pull/1606))