diff --git a/nethack-launcher/create_initial_files.go b/nethack-launcher/create_initial_files.go index 9a46221..5f60d98 100644 --- a/nethack-launcher/create_initial_files.go +++ b/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) { diff --git a/nethack-launcher/create_user_files.go b/nethack-launcher/create_user_files.go index 5772ae9..81923e2 100644 --- a/nethack-launcher/create_user_files.go +++ b/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() }