summaryrefslogtreecommitdiffstats
path: root/lib/agent/project-pathmap.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-11 00:24:02 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-10-11 00:24:02 +0200
commit4695555e178bcabe54c5bf82117c9c4cef5440b5 (patch)
tree96a8721de74347450b2e4922004b1bf01e415dfa /lib/agent/project-pathmap.go
parent882944a748d123c8715eca88536299d8570858f9 (diff)
Fixed Syncthing folder status events and exec command.
Diffstat (limited to 'lib/agent/project-pathmap.go')
-rw-r--r--lib/agent/project-pathmap.go26
1 files changed, 9 insertions, 17 deletions
diff --git a/lib/agent/project-pathmap.go b/lib/agent/project-pathmap.go
index 1de8e11..6c49d6a 100644
--- a/lib/agent/project-pathmap.go
+++ b/lib/agent/project-pathmap.go
@@ -1,16 +1,12 @@
package agent
-import (
- "path/filepath"
-)
-
// IPROJECT interface implementation for native/path mapping projects
// PathMap .
type PathMap struct {
*Context
server *XdsServer
- folder *FolderConfig
+ folder *XdsFolderConfig
}
// NewProjectPathMap Create a new instance of PathMap
@@ -18,7 +14,7 @@ func NewProjectPathMap(ctx *Context, svr *XdsServer) *PathMap {
p := PathMap{
Context: ctx,
server: svr,
- folder: &FolderConfig{},
+ folder: &XdsFolderConfig{},
}
return &p
}
@@ -49,10 +45,14 @@ func (p *PathMap) GetProject() *ProjectConfig {
return &prj
}
-// SetProject Set project config
-func (p *PathMap) SetProject(prj ProjectConfig) *ProjectConfig {
+// UpdateProject Set project config
+func (p *PathMap) UpdateProject(prj ProjectConfig) (*ProjectConfig, error) {
p.folder = p.server.ProjectToFolder(prj)
- return p.GetProject()
+ np := p.GetProject()
+ if err := p.events.Emit(EVTProjectChange, np); err != nil {
+ return np, err
+ }
+ return np, nil
}
// GetServer Get the XdsServer that holds this project
@@ -60,14 +60,6 @@ func (p *PathMap) GetServer() *XdsServer {
return p.server
}
-// GetFullPath returns the full path of a directory (from server POV)
-func (p *PathMap) GetFullPath(dir string) string {
- if &dir == nil {
- return p.folder.DataPathMap.ServerPath
- }
- return filepath.Join(p.folder.DataPathMap.ServerPath, dir)
-}
-
// Sync Force project files synchronization
func (p *PathMap) Sync() error {
return nil