1
- // SPDX-FileCopyrightText: 2018-2020 Michael Picht <[email protected] >
2
- //
3
- // SPDX-License-Identifier: GPL-3.0-or-later
4
-
5
1
package smsync
6
2
7
3
import (
@@ -11,8 +7,9 @@ import (
11
7
"time"
12
8
13
9
log "github.com/sirupsen/logrus"
14
- "gitlab.com/mipimipi/go-utils"
15
- "gitlab.com/mipimipi/go-utils/file"
10
+ "gitlab.com/go-utilities/file"
11
+ fp "gitlab.com/go-utilities/filepath"
12
+ "gitlab.com/go-utilities/reflect"
16
13
)
17
14
18
15
// errDir is the directory that stores error logs from conversion
@@ -32,14 +29,14 @@ func assembleTrgFile(cfg *Config, srcFile string) string {
32
29
// if corresponding conversion rule is for '*' ...
33
30
if cvm .TrgSuffix == suffixStar {
34
31
// ... target suffix is same as source suffix
35
- trgSuffix = file .Suffix (srcFile )
32
+ trgSuffix = fp .Suffix (srcFile )
36
33
} else {
37
34
// ... otherwise take target suffix from conversion rule
38
35
trgSuffix = cvm .TrgSuffix
39
36
}
40
37
41
- trgFile , err := file .PathRelCopy (cfg .SrcDir .Path (),
42
- file .PathTrunk (srcFile )+ "." + trgSuffix ,
38
+ trgFile , err := fp .PathRelCopy (cfg .SrcDir .Path (),
39
+ fp .PathTrunk (srcFile )+ "." + trgSuffix ,
43
40
cfg .TrgDir .Path ())
44
41
if err != nil {
45
42
log .Errorf ("Target path cannot be assembled: %v" , err )
@@ -72,7 +69,7 @@ func deleteObsoleteFiles(cfg *Config, srcDir file.Info) {
72
69
)
73
70
74
71
// assemble target directory path
75
- trgDir , err = file .PathRelCopy (cfg .SrcDir .Path (),
72
+ trgDir , err = fp .PathRelCopy (cfg .SrcDir .Path (),
76
73
srcDir .Path (),
77
74
cfg .TrgDir .Path ())
78
75
if err != nil {
@@ -125,8 +122,8 @@ func deleteObsoleteFiles(cfg *Config, srcDir file.Info) {
125
122
continue
126
123
}
127
124
// check if counterpart file on source side exists
128
- tr := file .PathTrunk (trgEntr .Name ())
129
- fs , err := filepath .Glob (file .EscapePattern (filepath .Join (srcDir .Path (), tr )) + ".*" )
125
+ tr := fp .PathTrunk (trgEntr .Name ())
126
+ fs , err := filepath .Glob (fp .EscapePattern (filepath .Join (srcDir .Path (), tr )) + ".*" )
130
127
if err != nil {
131
128
log .Errorf ("deleteObsoleteFiles: %v" , err )
132
129
return
@@ -202,7 +199,7 @@ func GetSyncFiles(cfg *Config, init bool) (files *[]*file.Info) {
202
199
203
200
// if a directory is excluded, itself and all sub directories and
204
201
// files are not relevant
205
- if utils .Contains (cfg .Excludes , srcFile .Path ()) {
202
+ if reflect .Contains (cfg .Excludes , srcFile .Path ()) {
206
203
return false , file .InvalidFromSuper
207
204
}
208
205
// if relevance is propagated from the parent, this directory is not
@@ -238,7 +235,7 @@ func GetSyncFiles(cfg *Config, init bool) (files *[]*file.Info) {
238
235
log .Debug ("Parent dir changed" )
239
236
240
237
// assemble target directory
241
- trgDir , _ := file .PathRelCopy (cfg .SrcDir .Path (), srcFile .Path (), cfg .TrgDir .Path ())
238
+ trgDir , _ := fp .PathRelCopy (cfg .SrcDir .Path (), srcFile .Path (), cfg .TrgDir .Path ())
242
239
// check if target directory exists
243
240
if exists , err := file .Exists (trgDir ); err == nil && ! exists {
244
241
log .Debug ("Trg doesn't exist -> FALSE, NONE FROM SUPER" )
0 commit comments