mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
🐛 修复 linux 路径问题
This commit is contained in:
parent
533f4a73f2
commit
5fd814d1d3
@ -74,12 +74,11 @@ func init() { // 插件主体
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// 下载图片
|
// 下载图片
|
||||||
file, err := download(illust, POOL.Path)
|
if _, err := download(illust, POOL.Path); err != nil {
|
||||||
if err != nil {
|
|
||||||
ctx.SendChain(message.Text("ERROR: ", err))
|
ctx.SendChain(message.Text("ERROR: ", err))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ctx.SendGroupMessage(POOL.Group, []message.MessageSegment{message.Image(file)})
|
ctx.SendGroupMessage(POOL.Group, []message.MessageSegment{message.Image(file(illust))})
|
||||||
// 向缓冲池添加一张图片
|
// 向缓冲池添加一张图片
|
||||||
POOL.Push(type_, illust)
|
POOL.Push(type_, illust)
|
||||||
|
|
||||||
@ -225,7 +224,7 @@ func (p *Pool) Pop(type_ string) (illust *pixiv.Illust) {
|
|||||||
func file(i *pixiv.Illust) string {
|
func file(i *pixiv.Illust) string {
|
||||||
filename := fmt.Sprint(i.Pid)
|
filename := fmt.Sprint(i.Pid)
|
||||||
pwd, _ := os.Getwd()
|
pwd, _ := os.Getwd()
|
||||||
filepath := pwd + `\` + POOL.Path + filename
|
filepath := pwd + `/` + POOL.Path + filename
|
||||||
if _, err := os.Stat(filepath + ".jpg"); err == nil || os.IsExist(err) {
|
if _, err := os.Stat(filepath + ".jpg"); err == nil || os.IsExist(err) {
|
||||||
return `file:///` + filepath + ".jpg"
|
return `file:///` + filepath + ".jpg"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user