From ebad1b3b3e88da4777c55cb0d97a37d96e9ca802 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:49:04 +1100 Subject: [PATCH 1/3] Don't empty directories if generated not set --- pkg/manager/manager.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 65deba48b71..acd23f8bd4f 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -67,8 +67,11 @@ func Initialize() *singleton { instance.RefreshConfig() // clear the downloads and tmp directories - utils.EmptyDir(instance.Paths.Generated.Downloads) - utils.EmptyDir(instance.Paths.Generated.Tmp) + // #1021 - only clear these directories if the generated folder is non-empty + if config.GetGeneratedPath() != "" { + utils.EmptyDir(instance.Paths.Generated.Downloads) + utils.EmptyDir(instance.Paths.Generated.Tmp) + } initFFMPEG() }) From 485f5bf7462628de932660aed3623e17b9911241 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:49:16 +1100 Subject: [PATCH 2/3] Rename downloads to download_stage --- pkg/manager/paths/paths_generated.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/manager/paths/paths_generated.go b/pkg/manager/paths/paths_generated.go index 91bbabed7c6..25aef7f4543 100644 --- a/pkg/manager/paths/paths_generated.go +++ b/pkg/manager/paths/paths_generated.go @@ -29,7 +29,7 @@ func newGeneratedPaths() *generatedPaths { gp.Vtt = filepath.Join(config.GetGeneratedPath(), "vtt") gp.Markers = filepath.Join(config.GetGeneratedPath(), "markers") gp.Transcodes = filepath.Join(config.GetGeneratedPath(), "transcodes") - gp.Downloads = filepath.Join(config.GetGeneratedPath(), "downloads") + gp.Downloads = filepath.Join(config.GetGeneratedPath(), "download_stage") gp.Tmp = filepath.Join(config.GetGeneratedPath(), "tmp") return &gp } From d18c480177cfe38ca04996e890788005dc4f7c96 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Tue, 2 Feb 2021 14:49:30 +1100 Subject: [PATCH 3/3] Add changelog entry --- ui/v2.5/src/components/Changelog/versions/v050.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/v2.5/src/components/Changelog/versions/v050.md b/ui/v2.5/src/components/Changelog/versions/v050.md index d2d6c7a9994..2ba575d72e3 100644 --- a/ui/v2.5/src/components/Changelog/versions/v050.md +++ b/ui/v2.5/src/components/Changelog/versions/v050.md @@ -29,6 +29,7 @@ * Support configurable number of threads for scanning and generation. ### 🐛 Bug fixes +* Fixed stash potentially deleting `downloads` directory when first run. * Fix sprite generation when generated path has special characters. * Prevent studio from being set as its own parent * Fixed performer scraper select overlapping search results