| OLD | NEW |
| 1 package main | 1 package main |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "bytes" | 4 "bytes" |
| 5 "crypto/md5" | 5 "crypto/md5" |
| 6 "database/sql" | 6 "database/sql" |
| 7 "encoding/base64" | 7 "encoding/base64" |
| 8 "encoding/binary" | 8 "encoding/binary" |
| 9 "encoding/json" | 9 "encoding/json" |
| 10 "flag" | 10 "flag" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 func init() { | 138 func init() { |
| 139 rand.Seed(time.Now().UnixNano()) | 139 rand.Seed(time.Now().UnixNano()) |
| 140 | 140 |
| 141 // Change the current working directory to the directory of the executab
le. | 141 // Change the current working directory to the directory of the executab
le. |
| 142 cwd, err := filepath.Abs(filepath.Dir(os.Args[0])) | 142 cwd, err := filepath.Abs(filepath.Dir(os.Args[0])) |
| 143 if err != nil { | 143 if err != nil { |
| 144 glog.Fatal(err) | 144 glog.Fatal(err) |
| 145 } | 145 } |
| 146 if err := os.Chdir(cwd); err != nil { | 146 if err := os.Chdir(cwd); err != nil { |
| 147 » » log.Fatal(err) | 147 » » glog.Fatal(err) |
| 148 } | 148 } |
| 149 | 149 |
| 150 codeTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "tem
plates/template.cpp"))) | 150 codeTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "tem
plates/template.cpp"))) |
| 151 gypTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "temp
lates/template.gyp"))) | 151 gypTemplate = template.Must(template.ParseFiles(filepath.Join(cwd, "temp
lates/template.gyp"))) |
| 152 indexTemplate = htemplate.Must(htemplate.ParseFiles( | 152 indexTemplate = htemplate.Must(htemplate.ParseFiles( |
| 153 filepath.Join(cwd, "templates/index.html"), | 153 filepath.Join(cwd, "templates/index.html"), |
| 154 filepath.Join(cwd, "templates/titlebar.html"), | 154 filepath.Join(cwd, "templates/titlebar.html"), |
| 155 filepath.Join(cwd, "templates/sidebar.html"), | 155 filepath.Join(cwd, "templates/sidebar.html"), |
| 156 filepath.Join(cwd, "templates/content.html"), | 156 filepath.Join(cwd, "templates/content.html"), |
| 157 filepath.Join(cwd, "templates/headercommon.html"), | 157 filepath.Join(cwd, "templates/headercommon.html"), |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) | 903 http.HandleFunc("/sources/", autogzip.HandleFunc(sourcesHandler)) |
| 904 | 904 |
| 905 // Resources are served directly | 905 // Resources are served directly |
| 906 // TODO add support for caching/etags/gzip | 906 // TODO add support for caching/etags/gzip |
| 907 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) | 907 http.Handle("/res/", autogzip.Handle(http.FileServer(http.Dir("./")))) |
| 908 | 908 |
| 909 // TODO Break out /c/ as it's own handler. | 909 // TODO Break out /c/ as it's own handler. |
| 910 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) | 910 http.HandleFunc("/", autogzip.HandleFunc(mainHandler)) |
| 911 glog.Fatal(http.ListenAndServe(*port, nil)) | 911 glog.Fatal(http.ListenAndServe(*port, nil)) |
| 912 } | 912 } |
| OLD | NEW |