|
|
@ -109,6 +109,13 @@ func checkFiles() { |
|
|
|
fmt.Printf("%s\n", err) |
|
|
|
fmt.Printf("%s\n", err) |
|
|
|
os.Exit(1) |
|
|
|
os.Exit(1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// make sure initial rcfile exists
|
|
|
|
|
|
|
|
hackRCLoc := fmt.Sprintf("%s/.nethackrc", config.NethackLauncher.HackDir) |
|
|
|
|
|
|
|
if _, err := os.Stat(hackRCLoc); os.IsNotExist(err) { |
|
|
|
|
|
|
|
glogger.Info.Printf("initial config file not found at: %s\n", hackRCLoc) |
|
|
|
|
|
|
|
fmt.Printf("%s\n", err) |
|
|
|
|
|
|
|
os.Exit(1) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func clearScreen() { |
|
|
|
func clearScreen() { |
|
|
@ -345,9 +352,6 @@ func printRegisterScreen(redisClient *redis.Client) { |
|
|
|
secHash := sha3.Sum512([]byte(sec)) |
|
|
|
secHash := sha3.Sum512([]byte(sec)) |
|
|
|
redisClient.Set(fmt.Sprintf("user:%s", username), fmt.Sprintf("%x", secHash), 0).Err() |
|
|
|
redisClient.Set(fmt.Sprintf("user:%s", username), fmt.Sprintf("%x", secHash), 0).Err() |
|
|
|
|
|
|
|
|
|
|
|
// TODO create config file
|
|
|
|
|
|
|
|
// HackDir/user/username/<config>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create user directories
|
|
|
|
// create user directories
|
|
|
|
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() |
|
|
|