aboutsummaryrefslogtreecommitdiffstats
path: root/lib/apiv1/make.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-08-10 12:19:34 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-08-16 14:27:28 +0200
commitdd6f08b10b1597f44e3dc25509ac9a45336b0914 (patch)
tree3dcb835306bc3adbae7c27d94fc8a51de8d6f09a /lib/apiv1/make.go
parent0262f5bef6ff67e77b844a04733c57740fba9f00 (diff)
Add folder interface and support native pathmap folder type.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/apiv1/make.go')
-rw-r--r--lib/apiv1/make.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/apiv1/make.go b/lib/apiv1/make.go
index 6ae840b..cf76476 100644
--- a/lib/apiv1/make.go
+++ b/lib/apiv1/make.go
@@ -76,11 +76,13 @@ func (s *APIService) buildMake(c *gin.Context) {
return
}
- prj := s.mfolder.GetFolderFromID(id)
- if prj == nil {
+ pf := s.mfolders.Get(id)
+ if pf == nil {
common.APIError(c, "Unknown id")
return
}
+ folder := *pf
+ prj := folder.GetConfig()
execTmo := args.CmdTimeout
if execTmo == 0 {
@@ -138,7 +140,7 @@ func (s *APIService) buildMake(c *gin.Context) {
exitImm := (*data)["ExitImmediate"].(bool)
// XXX - workaround to be sure that Syncthing detected all changes
- if err := s.mfolder.ForceSync(prjID); err != nil {
+ if err := s.mfolders.ForceSync(prjID); err != nil {
s.log.Errorf("Error while syncing folder %s: %v", prjID, err)
}
if !exitImm {
@@ -147,7 +149,7 @@ func (s *APIService) buildMake(c *gin.Context) {
tmo := 60
for t := tmo; t > 0; t-- {
s.log.Debugf("Wait file insync for %s (%d/%d)", prjID, t, tmo)
- if sync, err := s.mfolder.IsFolderInSync(prjID); sync || err != nil {
+ if sync, err := s.mfolders.IsFolderInSync(prjID); sync || err != nil {
if err != nil {
s.log.Errorf("ERROR IsFolderInSync (%s): %v", prjID, err)
}
@@ -179,7 +181,7 @@ func (s *APIService) buildMake(c *gin.Context) {
cmd = append(cmd, "&&")
}
- cmd = append(cmd, "cd", prj.GetFullPath(args.RPath), "&&", "make")
+ cmd = append(cmd, "cd", folder.GetFullPath(args.RPath), "&&", "make")
if len(args.Args) > 0 {
cmd = append(cmd, args.Args...)
}