解决了打开文件时有黑框的bug

This commit is contained in:
2024-10-12 16:00:32 +08:00
parent 7a6f815597
commit 88439dfb81
3 changed files with 14 additions and 17 deletions
+4 -8
View File
@@ -11,6 +11,7 @@ import (
"path/filepath"
"work_cation/cfg"
"work_cation/models"
"work_cation/pkg/utils"
)
func ExecFileCardView(w fyne.Window, data *models.BaseCard) (fyne.CanvasObject, error) {
@@ -34,17 +35,12 @@ func runExecFile(data *models.BaseCard, w fyne.Window) {
dialog.ShowInformation("测试失败", err.Error(), w)
return
}
ex := exec.Command("cmd", "/c", "start", info.Cmd)
ex.Dir = filepath.Join(cfg.T.CardDir, data.UUID, info.Pwd)
if err := ex.Start(); err != nil {
dir := filepath.Join(cfg.T.CardDir, data.UUID, info.Pwd)
err = utils.File.WinOpenFile(dir, info.Cmd)
if err != nil {
dialog.ShowInformation("测试失败", err.Error(), w)
return
}
go func() {
if err := ex.Wait(); err != nil {
dialog.ShowInformation("测试失败", err.Error(), w)
}
}()
}
func openDir(data *models.BaseCard, w fyne.Window) {