import (
"fmt"
+ "github.com/iotbzh/xds-server/lib/common"
"github.com/iotbzh/xds-server/lib/syncthing"
"github.com/iotbzh/xds-server/lib/xdsconfig"
)
return xdsconfig.FolderConfig{}, err
}
+ // Normalize path (needed for Windows path including bashlashes)
+ newFolder.RelativePath = common.PathNormalize(newFolder.RelativePath)
+
+ // Update config folder
c.Conf.Folders = c.Conf.Folders.Update(xdsconfig.FoldersConfig{newFolder})
+ // Update Syncthing folder
err := c.SThg.FolderChange(newFolder)
newFolder.BuilderSThgID = c.Conf.Builder.SyncThingID // FIXME - should be removed after local ST config rework
return fld, err
}
+
+// ForceSync Force the synchronization of a folder
+func (c *Folder) ForceSync(id string) error {
+ return c.SThg.FolderScan(id, "")
+}
+
+// IsFolderInSync Returns true when folder is in sync
+func (c *Folder) IsFolderInSync(id string) (bool, error) {
+ return c.SThg.IsFolderInSync(id)
+}