File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 55"io/ioutil"
66"log"
77"os"
8+ "path"
89"strings"
910
1011"github.com/d-dorazio/gork/gork"
@@ -13,6 +14,7 @@ import (
1314func main () {
1415if len (os .Args ) < 2 {
1516fmt .Println ("Please provide a game" )
17+ return
1618}
1719
1820story := os .Args [1 ]
@@ -22,7 +24,7 @@ func main() {
2224panic (err )
2325}
2426
25- logfile , err := os .Create (strings . Split (story , "." )[ 0 ] + ".log" )
27+ logfile , err := os .Create (storyLogFilename (story ) )
2628if err != nil {
2729panic (err )
2830}
@@ -35,6 +37,13 @@ func main() {
3537header := gork .NewZHeader (mem )
3638
3739gork .NewZMachine (mem , header , gork.ZTerminal {}).InterpretAll ()
40+ }
3841
39- fmt .Println ("" )
42+ func storyLogFilename (story string ) string {
43+ name := path .Base (story )
44+ tmp := strings .Split (name , "." )
45+ if len (tmp ) > 1 {
46+ name = tmp [0 ]
47+ }
48+ return name + ".log"
4049}
You can’t perform that action at this time.
0 commit comments