api/handlers/rest_POSTApiBreakpoints.go
// File generated by Gopher Sauce
// DO NOT EDIT!!
package handlers
import (
"io/ioutil"
"net/http"
"os"
"path/filepath"
"strings"
"github.com/cheikhshift/gos/core"
"github.com/gorilla/sessions"
"github.com/thestrukture/IDE/api/globals"
)
//
func POSTApiBreakpoints(w http.ResponseWriter, r *http.Request, session *sessions.Session) (response string, callmet bool) {
id := r.FormValue("id")
m := make(map[string]string)
var pkgpath = core.TrimSuffix(os.ExpandEnv("$GOPATH"), "/") + "/src/" + id + "/"
if globals.Windows {
pkgpath = strings.Replace(pkgpath, "/", "\\", -1)
}
_ = filepath.Walk(pkgpath, func(path string, file os.FileInfo, _ error) error {
//fmt.Println(path)
if file.IsDir() {
files, _ := ioutil.ReadDir(path)
for _, f := range files {
if !f.IsDir() && strings.Contains(f.Name(), "go-breakpoints") {
var mjk string
mjk = strings.Replace(path, pkgpath, "", -1) + "/" + f.Name()
if globals.Windows {
mjk = strings.Replace(mjk, "/", "\\", -1)
}
data, _ := ioutil.ReadFile(filepath.Join(path, f.Name()))
m[mjk] = string(data)
}
}
}
return nil
})
response = mResponse(m)
callmet = true
return
}