|
|
@ -11,10 +11,12 @@ func createUserFiles(username string) { |
|
|
|
userPath := fmt.Sprintf("%s/user/%s/ttyrec/", config.NethackLauncher.HackDir, username) |
|
|
|
userPath := fmt.Sprintf("%s/user/%s/ttyrec/", config.NethackLauncher.HackDir, username) |
|
|
|
exec.Command("mkdir", "-p", userPath).Run() |
|
|
|
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) |
|
|
|
hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir) |
|
|
|
|
|
|
|
if _, err := os.Stat(hackRCLoc); os.IsNotExist(err) { |
|
|
|
hackRCDest := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username) |
|
|
|
hackRCDest := fmt.Sprintf("%s/user/%s/.nethackrc", config.NethackLauncher.HackDir, username) |
|
|
|
exec.Command("cp", hackRCLoc, hackRCDest).Run() |
|
|
|
exec.Command("cp", hackRCLoc, hackRCDest).Run() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// create necessary directories if they dont exist
|
|
|
|
// create necessary directories if they dont exist
|
|
|
|
userpath := fmt.Sprintf("%s/user/%s", config.NethackLauncher.HackDir, username) |
|
|
|
userpath := fmt.Sprintf("%s/user/%s", config.NethackLauncher.HackDir, username) |
|
|
|