mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Use absolute paths when creating config file (#3417)
This commit is contained in:
parent
3cf97f6e27
commit
d2865b0796
1 changed files with 10 additions and 3 deletions
|
|
@ -586,18 +586,25 @@ func (s *Manager) Setup(ctx context.Context, input SetupInput) error {
|
|||
// create the config directory if it does not exist
|
||||
// don't do anything if config is already set in the environment
|
||||
if !config.FileEnvSet() {
|
||||
configDir := filepath.Dir(input.ConfigLocation)
|
||||
// #3304 - if config path is relative, it breaks the ffmpeg/ffprobe
|
||||
// paths since they must not be relative. The config file property is
|
||||
// resolved to an absolute path when stash is run normally, so convert
|
||||
// relative paths to absolute paths during setup.
|
||||
configFile, _ := filepath.Abs(input.ConfigLocation)
|
||||
|
||||
configDir := filepath.Dir(configFile)
|
||||
|
||||
if exists, _ := fsutil.DirExists(configDir); !exists {
|
||||
if err := os.Mkdir(configDir, 0755); err != nil {
|
||||
return fmt.Errorf("error creating config directory: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := fsutil.Touch(input.ConfigLocation); err != nil {
|
||||
if err := fsutil.Touch(configFile); err != nil {
|
||||
return fmt.Errorf("error creating config file: %v", err)
|
||||
}
|
||||
|
||||
s.Config.SetConfigFile(input.ConfigLocation)
|
||||
s.Config.SetConfigFile(configFile)
|
||||
}
|
||||
|
||||
// create the generated directory if it does not exist
|
||||
|
|
|
|||
Loading…
Reference in a new issue