|
|
|
@ -11,18 +11,12 @@ func createInitialFiles() {
|
|
|
|
|
if _, err := os.Stat(config.NethackLauncher.HackDir); os.IsNotExist(err) { |
|
|
|
|
os.Mkdir(config.NethackLauncher.HackDir, os.ModeDir) |
|
|
|
|
} |
|
|
|
|
if _, err := os.Stat(fmt.Sprintf("%s/dumps/", config.NethackLauncher.HackDir)); os.IsNotExist(err) { |
|
|
|
|
os.Mkdir(fmt.Sprintf("%s/dumps/", config.NethackLauncher.HackDir), os.ModeDir) |
|
|
|
|
} |
|
|
|
|
if _, err := os.Stat(fmt.Sprintf("%s/save/", config.NethackLauncher.HackDir)); os.IsNotExist(err) { |
|
|
|
|
os.Mkdir(fmt.Sprintf("%s/save/", config.NethackLauncher.HackDir), os.ModeDir) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// create necessary files if they dont exist
|
|
|
|
|
os.OpenFile(fmt.Sprintf("%s/logfile", config.NethackLauncher.HackDir), os.O_RDONLY|os.O_CREATE, 0666) |
|
|
|
|
os.OpenFile(fmt.Sprintf("%s/perm", config.NethackLauncher.HackDir), os.O_RDONLY|os.O_CREATE, 0666) |
|
|
|
|
os.OpenFile(fmt.Sprintf("%s/record", config.NethackLauncher.HackDir), os.O_RDONLY|os.O_CREATE, 0666) |
|
|
|
|
os.OpenFile(fmt.Sprintf("%s/xlogfile", config.NethackLauncher.HackDir), os.O_RDONLY|os.O_CREATE, 0666) |
|
|
|
|
//if _, err := os.Stat(fmt.Sprintf("%s/dumps/", config.NethackLauncher.HackDir)); os.IsNotExist(err) {
|
|
|
|
|
// os.Mkdir(fmt.Sprintf("%s/dumps/", config.NethackLauncher.HackDir), os.ModeDir)
|
|
|
|
|
//}
|
|
|
|
|
//if _, err := os.Stat(fmt.Sprintf("%s/save/", config.NethackLauncher.HackDir)); os.IsNotExist(err) {
|
|
|
|
|
// os.Mkdir(fmt.Sprintf("%s/save/", config.NethackLauncher.HackDir), os.ModeDir)
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// move in nhdat file if it does not exist
|
|
|
|
|
if _, err := os.Stat(fmt.Sprintf("%s/nhdat", config.NethackLauncher.HackDir)); os.IsNotExist(err) { |
|
|
|
|