Browse Source

Do not overwrite user config on login

develop
Matthew Faltys 2 years ago
parent
commit
bd8fd497c1
  1. 8
      nethack-launcher/create_user_files.go

8
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)

Loading…
Cancel
Save