summaryrefslogtreecommitdiffstats
path: root/lib/syncthing
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syncthing')
-rw-r--r--lib/syncthing/folder-st.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/syncthing/folder-st.go b/lib/syncthing/folder-st.go
index da27062..a372b6f 100644
--- a/lib/syncthing/folder-st.go
+++ b/lib/syncthing/folder-st.go
@@ -3,6 +3,7 @@ package st
import (
"fmt"
"path/filepath"
+ "strings"
"github.com/iotbzh/xds-server/lib/folder"
"github.com/iotbzh/xds-server/lib/xdsconfig"
@@ -93,7 +94,7 @@ func (f *STFolder) GetConfig() folder.FolderConfig {
return f.fConfig
}
-// GetFullPath returns the full path
+// GetFullPath returns the full path of a directory (from server POV)
func (f *STFolder) GetFullPath(dir string) string {
if &dir == nil {
dir = ""
@@ -104,6 +105,28 @@ func (f *STFolder) GetFullPath(dir string) string {
return filepath.Join(f.fConfig.RootPath, f.fConfig.ClientPath, dir)
}
+// ConvPathCli2Svr Convert path from Client to Server
+func (f *STFolder) ConvPathCli2Svr(s string) string {
+ if f.fConfig.ClientPath != "" && f.fConfig.RootPath != "" {
+ return strings.Replace(s,
+ f.fConfig.ClientPath,
+ f.fConfig.RootPath+"/"+f.fConfig.ClientPath,
+ -1)
+ }
+ return s
+}
+
+// ConvPathSvr2Cli Convert path from Server to Client
+func (f *STFolder) ConvPathSvr2Cli(s string) string {
+ if f.fConfig.ClientPath != "" && f.fConfig.RootPath != "" {
+ return strings.Replace(s,
+ f.fConfig.RootPath+"/"+f.fConfig.ClientPath,
+ f.fConfig.ClientPath,
+ -1)
+ }
+ return s
+}
+
// Remove a folder
func (f *STFolder) Remove() error {
return f.st.FolderDelete(f.stfConfig.ID)