44 "fmt"
55 "io/ioutil"
66 "log"
7+ "os"
78 "path/filepath"
89
910 "github.com/codegangsta/cli"
@@ -22,12 +23,26 @@ func Submit(ctx *cli.Context) {
2223 log .Fatal (err )
2324 }
2425
26+ if ctx .GlobalBool ("debug" ) {
27+ log .Printf ("Exercises dir: %s" , c .Dir )
28+ dir , err := os .Getwd ()
29+ if err != nil {
30+ log .Printf ("Unable to get current working directory - %s" , err )
31+ } else {
32+ log .Printf ("Current dir: %s" , dir )
33+ }
34+ }
35+
2536 if ! c .IsAuthenticated () {
2637 log .Fatal (msgPleaseAuthenticate )
2738 }
2839
2940 filename := ctx .Args ()[0 ]
3041
42+ if ctx .GlobalBool ("debug" ) {
43+ log .Printf ("file name: %s" , filename )
44+ }
45+
3146 if isTest (filename ) {
3247 log .Fatal ("Please submit the solution, not the test file." )
3348 }
@@ -36,16 +51,29 @@ func Submit(ctx *cli.Context) {
3651 if err != nil {
3752 log .Fatal (err )
3853 }
54+
55+ if ctx .GlobalBool ("debug" ) {
56+ log .Printf ("absolute path: %s" , file )
57+ }
58+
3959 file , err = filepath .EvalSymlinks (file )
4060 if err != nil {
4161 log .Fatal (err )
4262 }
4363
64+ if ctx .GlobalBool ("debug" ) {
65+ log .Printf ("eval symlinks (file): %s" , file )
66+ }
67+
4468 dir , err := filepath .EvalSymlinks (c .Dir )
4569 if err != nil {
4670 log .Fatal (err )
4771 }
4872
73+ if ctx .GlobalBool ("debug" ) {
74+ log .Printf ("eval symlinks (dir): %s" , dir )
75+ }
76+
4977 code , err := ioutil .ReadFile (file )
5078 if err != nil {
5179 log .Fatalf ("Cannot read the contents of %s - %s\n " , filename , err )
0 commit comments