Browse Source

修复 setconfigselfpath 启动参数失效的问题

Signed-off-by: allan716 <[email protected]>
allan716 3 years ago
parent
commit
ec73225ee8
1 changed files with 3 additions and 1 deletions
  1. 3 1
      cmd/chinesesubfinder/main.go

+ 3 - 1
cmd/chinesesubfinder/main.go

@@ -45,10 +45,12 @@ func newLog() *logrus.Logger {
 }
 
 func init() {
-	settings.SetConfigRootPath(pkg.ConfigRootDirFPath())
+
 	// 要先进行 flag 的读取,并且写入全局变量中,否则后续的逻辑由于顺序问题故障
 	flag.Parse()
 	pkg.SetLinuxConfigPathInSelfPath(*setLinuxConfigPathInSelfPathFlag)
+	// 需要进行 settings 的初始化,指定初始化的目录
+	settings.SetConfigRootPath(pkg.ConfigRootDirFPath())
 	// 第一次运行需要清理、读取一次
 	log_helper.CleanAndLoadOnceLogs()
 	loggerBase = newLog()