mirror of
https://github.com/ddworken/hishtory.git
synced 2024-11-22 16:24:00 +01:00
windows: restore the cd ../ behavior, but for windows
This commit is contained in:
parent
5954efbb3b
commit
456513d71e
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user