diff --git a/nethack-launcher/create_user_files.go b/nethack-launcher/create_user_files.go index 2248851..9296a65 100644 --- a/nethack-launcher/create_user_files.go +++ b/nethack-launcher/create_user_files.go @@ -11,10 +11,12 @@ func createUserFiles(username string) { userPath := fmt.Sprintf("%s/user/%s/ttyrec/", config.NethackLauncher.HackDir, username) exec.Command("mkdir", "-p", userPath).Run() - // copy in rc file + // copy in rc file if it does not exist hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir) - hackRCDest := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username) - exec.Command("cp", hackRCLoc, hackRCDest).Run() + if _, err := os.Stat(hackRCLoc); os.IsNotExist(err) { + hackRCDest := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username) + exec.Command("cp", hackRCLoc, hackRCDest).Run() + } // create necessary directories if they dont exist userpath := fmt.Sprintf("%s/user/%s", config.NethackLauncher.HackDir, username)