This commit is contained in:
parent
932d472c0d
commit
533434fe43
|
@ -36,6 +36,14 @@ type conf struct {
|
||||||
var Wide conf
|
var Wide conf
|
||||||
var rawWide conf
|
var rawWide conf
|
||||||
|
|
||||||
|
func (this *conf) GetWorkspace() string {
|
||||||
|
return filepath.FromSlash(this.Workspace)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *conf) GetUserWorkspace(username string) string {
|
||||||
|
return filepath.FromSlash(this.UserWorkspaces) + string(os.PathSeparator) + username
|
||||||
|
}
|
||||||
|
|
||||||
func Save() bool {
|
func Save() bool {
|
||||||
// 可变部分
|
// 可变部分
|
||||||
rawWide.Users = Wide.Users
|
rawWide.Users = Wide.Users
|
||||||
|
|
|
@ -21,12 +21,12 @@ func GetFiles(w http.ResponseWriter, r *http.Request) {
|
||||||
session, _ := user.Session.Get(r, "wide-session")
|
session, _ := user.Session.Get(r, "wide-session")
|
||||||
|
|
||||||
username := session.Values["username"].(string)
|
username := session.Values["username"].(string)
|
||||||
userRepos := conf.Wide.UserWorkspaces + string(os.PathSeparator) + username + string(os.PathSeparator) + "src"
|
userSrc := conf.Wide.GetUserWorkspace(username) + string(os.PathSeparator) + "src"
|
||||||
|
|
||||||
root := FileNode{"projects", userRepos, "d", []*FileNode{}}
|
root := FileNode{"projects", userSrc, "d", []*FileNode{}}
|
||||||
fileInfo, _ := os.Lstat(userRepos)
|
fileInfo, _ := os.Lstat(userSrc)
|
||||||
|
|
||||||
walk(userRepos, fileInfo, &root)
|
walk(userSrc, fileInfo, &root)
|
||||||
|
|
||||||
data["root"] = root
|
data["root"] = root
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,7 @@ func BuildHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func setCmdEnv(cmd *exec.Cmd, username string) {
|
func setCmdEnv(cmd *exec.Cmd, username string) {
|
||||||
userWorkspace := conf.Wide.UserWorkspaces + string(os.PathSeparator) + username
|
userWorkspace := conf.Wide.GetUserWorkspace(username)
|
||||||
|
|
||||||
cmd.Env = append(cmd.Env,
|
cmd.Env = append(cmd.Env,
|
||||||
"GOPATH="+userWorkspace,
|
"GOPATH="+userWorkspace,
|
||||||
|
|
Loading…
Reference in New Issue