improved file read/copy logic
This commit is contained in:
25
main.go
25
main.go
@@ -1,8 +1,6 @@
|
||||
package main
|
||||
|
||||
const BASEPATH = "./rooms"
|
||||
const OUTPATH = "./rooms_out"
|
||||
const ROOM_PER_NIGHT = 4
|
||||
import "flag"
|
||||
|
||||
func main() {
|
||||
if err := mainErr(); err != nil {
|
||||
@@ -11,12 +9,27 @@ func main() {
|
||||
}
|
||||
|
||||
func mainErr() error {
|
||||
roomFolders, err := LoadRoomFolders(BASEPATH)
|
||||
basePath := flag.String("basePath", "./rooms", "path to your rooms collection")
|
||||
outPath := flag.String("outPath", "./rooms_out", "output path")
|
||||
roomPerNight := flag.Int("roomPerNight", 4, "rooms per night")
|
||||
|
||||
splash1len := flag.Int("splash1", 2, "number of seconds splashscreen 1 will take")
|
||||
splash2len := flag.Int("splash2", 2, "number of seconds splashscreen 2 will take")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
roomFolders, err := LoadRoomFolders(*basePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
AssignExtraRooms(roomFolders, ROOM_PER_NIGHT)
|
||||
AssignExtraRooms(roomFolders, *roomPerNight)
|
||||
|
||||
return CopyOut(roomFolders, OUTPATH)
|
||||
// only deletes DATA/NIGHT_* folders and the CF.ini file
|
||||
err = EmptyOut(*outPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return CopyOut(roomFolders, *outPath, *splash1len, *splash2len)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user