mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
FFMPEG auto download
This commit is contained in:
@@ -3,13 +3,9 @@ package paths
|
||||
import (
|
||||
"github.com/stashapp/stash/manager/jsonschema"
|
||||
"github.com/stashapp/stash/utils"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type Paths struct {
|
||||
FixedPaths *fixedPaths
|
||||
Config *jsonschema.Config
|
||||
Generated *generatedPaths
|
||||
JSON *jsonPaths
|
||||
@@ -20,15 +16,13 @@ type Paths struct {
|
||||
}
|
||||
|
||||
func RefreshPaths() *Paths {
|
||||
fp := newFixedPaths()
|
||||
ensureConfigFile(fp)
|
||||
return newPaths(fp)
|
||||
ensureConfigFile()
|
||||
return newPaths()
|
||||
}
|
||||
|
||||
func newPaths(fp *fixedPaths) *Paths {
|
||||
func newPaths() *Paths {
|
||||
p := Paths{}
|
||||
p.FixedPaths = fp
|
||||
p.Config = jsonschema.LoadConfigFile(p.FixedPaths.ConfigFile)
|
||||
p.Config = jsonschema.LoadConfigFile(StaticPaths.ConfigFile)
|
||||
p.Generated = newGeneratedPaths(p)
|
||||
p.JSON = newJSONPaths(p)
|
||||
|
||||
@@ -38,24 +32,8 @@ func newPaths(fp *fixedPaths) *Paths {
|
||||
return &p
|
||||
}
|
||||
|
||||
func getExecutionDirectory() string {
|
||||
ex, err := os.Executable()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return filepath.Dir(ex)
|
||||
}
|
||||
|
||||
func getHomeDirectory() string {
|
||||
currentUser, err := user.Current()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return currentUser.HomeDir
|
||||
}
|
||||
|
||||
func ensureConfigFile(fp *fixedPaths) {
|
||||
configFileExists, _ := utils.FileExists(fp.ConfigFile) // TODO: Verify JSON is correct. Pass verified
|
||||
func ensureConfigFile() {
|
||||
configFileExists, _ := utils.FileExists(StaticPaths.ConfigFile) // TODO: Verify JSON is correct. Pass verified
|
||||
if configFileExists {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user