Browse Source

Fix high-score function

feature/nightly-build
Matthew Faltys 5 years ago
parent
commit
e39fbeceef
  1. 5
      nethack-launcher/create_initial_files.go
  2. 4
      nethack-launcher/create_user_files.go

5
nethack-launcher/create_initial_files.go

@ -17,6 +17,11 @@ func createInitialFiles() {
exec.Command("cp", config.NethackLauncher.NhdatLocation, config.NethackLauncher.HackDir).Run()
}
// make sure record file exists
if _, err := os.Stat(fmt.Sprintf("%s/record", config.NethackLauncher.HackDir)); os.IsNotExist(err) {
os.OpenFile(fmt.Sprintf("%s/record", config.NethackLauncher.HackDir), os.O_RDONLY|os.O_CREATE, 0666)
}
// make sure initial rcfile exists
hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir)
if _, err := os.Stat(hackRCLoc); os.IsNotExist(err) {

4
nethack-launcher/create_user_files.go

@ -29,9 +29,11 @@ func createUserFiles(username string) {
// create necessary files if they dont exist
os.OpenFile(fmt.Sprintf("%s/logfile", userpath), os.O_RDONLY|os.O_CREATE, 0666)
os.OpenFile(fmt.Sprintf("%s/perm", userpath), os.O_RDONLY|os.O_CREATE, 0666)
os.OpenFile(fmt.Sprintf("%s/record", userpath), os.O_RDONLY|os.O_CREATE, 0666)
os.OpenFile(fmt.Sprintf("%s/xlogfile", userpath), os.O_RDONLY|os.O_CREATE, 0666)
// create record symlink
exec.Command("ln", "-s", fmt.Sprintf("%s/record", config.NethackLauncher.HackDir), fmt.Sprintf("%s/record", userpath)).Run()
// move in nhdat file if it does not exist
exec.Command("cp", fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir), userpath).Run()
}

Loading…
Cancel
Save