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
This commit is contained in:
gitgiggety 2021-08-10 06:58:14 +02:00 committed by GitHub
parent 59c7dd622b
commit 915533b8c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -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 {

View File

@ -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))