Skip to content

Commit 2ece5ee

Browse files
committed
android set device dir
1 parent c7ba86c commit 2ece5ee

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pkg/device/device.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
log "github.com/sirupsen/logrus"
2020
)
2121

22+
var Path = "device"
23+
2224
func RandDevice(randGen *rand.Rand) *client.DeviceInfo {
2325
device := &client.DeviceInfo{
2426
AndroidId: []byte("MIRAI.123456.001"),
@@ -109,7 +111,7 @@ func GetDevice(seed int64, clientProtocol int32) *client.DeviceInfo {
109111
randGen = rand.New(rand.NewSource(time.Now().UnixNano()))
110112
}
111113
// 默认 device/device-qq.json
112-
devicePath := path.Join("device", fmt.Sprintf("device-%d.json", seed))
114+
devicePath := path.Join(Path, fmt.Sprintf("device-%d.json", seed))
113115

114116
// 优先使用参数目录
115117
if config.Device != "" {

service/gmc_android/gmc.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gmc_android
22

33
import (
44
"github.com/ProtobufBot/Go-Mirai-Client/pkg/config"
5+
"github.com/ProtobufBot/Go-Mirai-Client/pkg/device"
56
"github.com/ProtobufBot/Go-Mirai-Client/pkg/gmc"
67

78
log "github.com/sirupsen/logrus"
@@ -25,6 +26,11 @@ func SetLogPath(logPath string) {
2526
gmc.LogPath = logPath
2627
}
2728

29+
// SetDevicePath 设置设备信息路径
30+
func SetDevicePath(devicePath string) {
31+
device.Path = devicePath
32+
}
33+
2834
// Start 启动主程序
2935
func Start() {
3036
gmc.Start()

0 commit comments

Comments
 (0)