~welt/murse

a4599daf82c117a8fe27860a9e514fa0c8b95239 — welt 2 months ago e0a6343
Fix path logic, and add build to .gitignore.
2 files changed, 24 insertions(+), 7 deletions(-)

M .gitignore
M verify.go
M .gitignore => .gitignore +1 -0
@@ 3,3 3,4 @@ murse.exe
murse
./murse
open_fortress/
build
\ No newline at end of file

M verify.go => verify.go +23 -7
@@ 7,6 7,7 @@ import (
	"io"
	"os"
	"path/filepath"
	"sort"
	"strings"
)



@@ 67,8 68,17 @@ func verifyMain(dir string, url string, repair bool, http2 bool, owGameInfo bool
		}
	}

	for _, change := range mkdirs {
		path, err := resolvePath(dir, change.Path)
	var mkdirpaths []string
	for _, v := range mkdirs {
		mkdirpaths = append(mkdirpaths, v.Path)
	}

	// Sort so that parents are done first,
	// then children.
	sort.Strings(mkdirpaths)

	for _, opath := range mkdirpaths {
		path, err := resolvePath(dir, opath)
		if err != nil {
			errPrintln(err)
			return 1


@@ 77,7 87,7 @@ func verifyMain(dir string, url string, repair bool, http2 bool, owGameInfo bool
		stat, err := os.Stat(path)
		if err != nil {
			if os.IsNotExist(err) {
				fmt.Println("MISSING", change.Path)
				fmt.Println("MISSING", opath)
				if repair {
					err := os.MkdirAll(path, 0777)
					if err != nil {


@@ 85,7 95,7 @@ func verifyMain(dir string, url string, repair bool, http2 bool, owGameInfo bool
						return 1
					}

					fmt.Println("FIXDIR", change.Path)
					fmt.Println("FIXDIR", opath)

				}
			} else {


@@ 94,7 104,7 @@ func verifyMain(dir string, url string, repair bool, http2 bool, owGameInfo bool
			}
		} else {
			if !stat.IsDir() {
				fmt.Println("NOTDIR", change.Path)
				fmt.Println("NOTDIR", opath)
				if repair {
					err := os.RemoveAll(path)
					if err != nil {


@@ 108,14 118,20 @@ func verifyMain(dir string, url string, repair bool, http2 bool, owGameInfo bool
						return 1
					}

					fmt.Println("FIXDIR", change.Path)
					fmt.Println("FIXDIR", opath)

				}
			}
		}
	}

	isOF := (filepath.Dir(dir) == "open_fortress")
	absPath, err := filepath.Abs(dir)
	if err != nil {
		errPrintln(err)
		return 1
	}

	isOF := (filepath.Dir(absPath) == "open_fortress")

	for _, change := range writes {
		path, err := resolvePath(dir, change.Path)