windows: restore the cd ../ behavior, but for windows

This commit is contained in:
David Dworken 2022-11-06 14:42:01 -08:00
parent 5954efbb3b
commit 456513d71e
No known key found for this signature in database

View File

@ -162,22 +162,20 @@ func checkError(err error) {
}
func buildServer() {
if runtime.GOOS != "windows" {
for {
wd, err := os.Getwd()
if err != nil {
panic(fmt.Sprintf("failed to getwd: %v", err))
}
if strings.HasSuffix(wd, "/hishtory") {
break
}
err = os.Chdir("../")
if err != nil {
panic(fmt.Sprintf("failed to chdir: %v", err))
}
if wd == "/" {
panic("failed to cd into hishtory dir!")
}
for i := 0; i < 100; i++ {
wd, err := os.Getwd()
if err != nil {
panic(fmt.Sprintf("failed to getwd: %v", err))
}
if strings.HasSuffix(wd, "hishtory") {
break
}
err = os.Chdir("../")
if err != nil {
panic(fmt.Sprintf("failed to chdir: %v", err))
}
if wd == "/" {
panic("failed to cd into hishtory dir!")
}
}
version, err := os.ReadFile("VERSION")