]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
Fix 检查直播流保存路径是否为目录
authorqydysky <32743305+qydysky@users.noreply.github.com>
Sat, 21 Jan 2023 15:08:31 +0000 (23:08 +0800)
committerqydysky <32743305+qydysky@users.noreply.github.com>
Sat, 21 Jan 2023 15:08:31 +0000 (23:08 +0800)
Reply/stream.go

index 288e6dfdcd2b05f5db2898f4a8d774305e5c6047..f069d65b3725e4fd0f7fdb8d39f87c1e57403dcf 100644 (file)
@@ -144,7 +144,7 @@ func (t *M4SStream) LoadConfig(common c.Common, l *log.Log_interface) {
        //读取配置
        if path, ok := common.K_v.LoadV("直播流保存位置").(string); ok {
                if path, err := filepath.Abs(path); err == nil {
-                       if _, err := os.Stat(path); err != nil {
+                       if fs, err := os.Stat(path); err != nil {
                                if errors.Is(err, os.ErrNotExist) {
                                        if err := p.File().NewPath(path); err != nil {
                                                t.log.L(`E: `, `直播流保存位置错误`, err)
@@ -154,6 +154,9 @@ func (t *M4SStream) LoadConfig(common c.Common, l *log.Log_interface) {
                                        t.log.L(`E: `, `直播流保存位置错误`, err)
                                        return
                                }
+                       } else if !fs.IsDir() {
+                               t.log.L(`E: `, `直播流保存位置不是目录`)
+                               return
                        }
                        t.config.save_path = path + "/"
                } else {