mirror of https://github.com/Xhofe/alist
feat!: disable `--force-bin-dir` if `--data` is abs
related issues: #2580 #2542 after this commit, the `--force-bin-dir` would take no effect if `--data` is absolute pathpull/2587/head
parent
bf8b6f4c2c
commit
97f1efbb72
|
@ -13,12 +13,14 @@ import (
|
||||||
|
|
||||||
func InitConfig() {
|
func InitConfig() {
|
||||||
if flags.ForceBinDir {
|
if flags.ForceBinDir {
|
||||||
ex, err := os.Executable()
|
if !filepath.IsAbs(flags.DataDir) {
|
||||||
if err != nil {
|
ex, err := os.Executable()
|
||||||
utils.Log.Fatal(err)
|
if err != nil {
|
||||||
|
utils.Log.Fatal(err)
|
||||||
|
}
|
||||||
|
exPath := filepath.Dir(ex)
|
||||||
|
flags.DataDir = filepath.Join(exPath, flags.DataDir)
|
||||||
}
|
}
|
||||||
exPath := filepath.Dir(ex)
|
|
||||||
flags.DataDir = filepath.Join(exPath, "data")
|
|
||||||
}
|
}
|
||||||
configPath := filepath.Join(flags.DataDir, "config.json")
|
configPath := filepath.Join(flags.DataDir, "config.json")
|
||||||
log.Infof("reading config file: %s", configPath)
|
log.Infof("reading config file: %s", configPath)
|
||||||
|
|
Loading…
Reference in New Issue