Skip to content

Commit

Permalink
🐛 修复 linux 路径问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kanrichan committed Jun 21, 2021
1 parent 533f4a7 commit 5fd814d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions setutime/setu_geter.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ func init() { // 插件主体
continue
}
// 下载图片
file, err := download(illust, POOL.Path)
if err != nil {
if _, err := download(illust, POOL.Path); err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
continue
}
ctx.SendGroupMessage(POOL.Group, []message.MessageSegment{message.Image(file)})
ctx.SendGroupMessage(POOL.Group, []message.MessageSegment{message.Image(file(illust))})
// 向缓冲池添加一张图片
POOL.Push(type_, illust)

Expand Down Expand Up @@ -225,7 +224,7 @@ func (p *Pool) Pop(type_ string) (illust *pixiv.Illust) {
func file(i *pixiv.Illust) string {
filename := fmt.Sprint(i.Pid)
pwd, _ := os.Getwd()
filepath := pwd + `\` + POOL.Path + filename
filepath := pwd + `/` + POOL.Path + filename
if _, err := os.Stat(filepath + ".jpg"); err == nil || os.IsExist(err) {
return `file:///` + filepath + ".jpg"
}
Expand Down

0 comments on commit 5fd814d

Please sign in to comment.