wip update
This commit is contained in:
18
config.go
18
config.go
@ -1,10 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/sqweek/dialog"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
@ -38,23 +36,13 @@ func setupConfig(rerun bool) (*Config, error) {
|
||||
|
||||
_, statErr := os.Stat(cfgPath)
|
||||
if rerun || os.IsNotExist(statErr) {
|
||||
fmt.Println("Press any key to open a file window and select your wow directory")
|
||||
var r rune
|
||||
_, _ = 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
|
||||
}
|
||||
fmt.Println("Enter the path to your Wow directory below:")
|
||||
fmt.Scanln(&newConfig.WowDir)
|
||||
|
||||
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): ")
|
||||
var s string
|
||||
_, err = fmt.Scanf("%s", &s)
|
||||
_, err := fmt.Scanf("%s", &s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
7
go.mod
7
go.mod
@ -2,9 +2,4 @@ module git.burkey.co/eburk/epochcli
|
||||
|
||||
go 1.24.3
|
||||
|
||||
require (
|
||||
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
|
||||
require github.com/BurntSushi/toml v1.5.0
|
||||
|
4
go.sum
4
go.sum
@ -1,6 +1,2 @@
|
||||
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/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=
|
||||
|
3
main.go
3
main.go
@ -102,12 +102,13 @@ func downloadUpdate(config *Config) (int, int, error) {
|
||||
hashBytes := md5.Sum(data)
|
||||
hash := hex.EncodeToString(hashBytes[:])
|
||||
if hash == file.Hash {
|
||||
fmt.Printf("File %s is up to date\n", localPath)
|
||||
currentCount += 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("Updating %s...\n", file.Path)
|
||||
fmt.Printf(" %s...\n", localPath)
|
||||
|
||||
outFile, err := os.Create(localPath)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user