// Open a new freeze log func (server *Server) openFreezeLog() (err error) { logfn := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "log.fz") // If the freeze log file is still open, close it so we can remove it if server.freezelog != nil { server.freezelog.Close() } err = os.Remove(logfn) if os.IsNotExist(err) { // OK. File does not exist... } else if err != nil { return err } server.freezelog, err = freezer.NewLogFile(logfn) if err != nil { return err } return nil }
// Open a new freeze log. func (server *Server) openFreezeLog() error { if server.freezelog != nil { err := server.freezelog.Close() if err != nil { return err } } logfn := filepath.Join(Args.DataDir, "servers", strconv.FormatInt(server.Id, 10), "log.fz") err := os.Remove(logfn) if os.IsNotExist(err) { // fallthrough } else if err != nil { return err } server.freezelog, err = freezer.NewLogFile(logfn) if err != nil { return err } return nil }