wip update

This commit is contained in:
2025-06-13 10:19:33 -07:00
parent a281948d0b
commit 656109e935
4 changed files with 6 additions and 26 deletions

View File

@ -1,10 +1,8 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/sqweek/dialog"
"os" "os"
"path/filepath" "path/filepath"
) )
@ -38,23 +36,13 @@ func setupConfig(rerun bool) (*Config, error) {
_, statErr := os.Stat(cfgPath) _, statErr := os.Stat(cfgPath)
if rerun || os.IsNotExist(statErr) { if rerun || os.IsNotExist(statErr) {
fmt.Println("Press any key to open a file window and select your wow directory") fmt.Println("Enter the path to your Wow directory below:")
var r rune fmt.Scanln(&newConfig.WowDir)
_, _ = fmt.Scanf("%c", &r)
var err error
newConfig.WowDir, err = dialog.Directory().Title("Select your wow directory").Browse()
if err != nil {
if errors.Is(err, dialog.ErrCancelled) {
return nil, fmt.Errorf("cancelled dialog box, exiting")
}
return nil, err
}
for { for {
fmt.Printf("Do you want to use epochcli to launch Wow? Select No if you plan on using a launcher tool like Lutris (y/n): ") fmt.Printf("Do you want to use epochcli to launch Wow? Select No if you plan on using a launcher tool like Lutris (y/n): ")
var s string var s string
_, err = fmt.Scanf("%s", &s) _, err := fmt.Scanf("%s", &s)
if err != nil { if err != nil {
return nil, err return nil, err
} }

7
go.mod
View File

@ -2,9 +2,4 @@ module git.burkey.co/eburk/epochcli
go 1.24.3 go 1.24.3
require ( require github.com/BurntSushi/toml v1.5.0
github.com/BurntSushi/toml v1.5.0
github.com/sqweek/dialog v0.0.0-20240226140203-065105509627
)
require github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf // indirect

4
go.sum
View File

@ -1,6 +1,2 @@
github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg= github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf h1:FPsprx82rdrX2jiKyS17BH6IrTmUBYqZa/CXT4uvb+I=
github.com/TheTitanrain/w32 v0.0.0-20180517000239-4f5cfb03fabf/go.mod h1:peYoMncQljjNS6tZwI9WVyQB3qZS6u79/N3mBOcnd3I=
github.com/sqweek/dialog v0.0.0-20240226140203-065105509627 h1:2JL2wmHXWIAxDofCK+AdkFi1KEg3dgkefCsm7isADzQ=
github.com/sqweek/dialog v0.0.0-20240226140203-065105509627/go.mod h1:/qNPSY91qTz/8TgHEMioAUc6q7+3SOybeKczHMXFcXw=

View File

@ -102,12 +102,13 @@ func downloadUpdate(config *Config) (int, int, error) {
hashBytes := md5.Sum(data) hashBytes := md5.Sum(data)
hash := hex.EncodeToString(hashBytes[:]) hash := hex.EncodeToString(hashBytes[:])
if hash == file.Hash { if hash == file.Hash {
fmt.Printf("File %s is up to date\n", localPath)
currentCount += 1 currentCount += 1
continue continue
} }
} }
fmt.Printf("Updating %s...\n", file.Path) fmt.Printf(" %s...\n", localPath)
outFile, err := os.Create(localPath) outFile, err := os.Create(localPath)
if err != nil { if err != nil {