@@ -123,8 +123,9 @@ type InitSection struct {
123
123
func (i * InitSection ) IsEmpty () bool { return i == nil }
124
124
125
125
func (i * InitSection ) setRootPath (_ * Profile , rootPath string ) {
126
- i .FromRepositoryFile = fixPath (i .FromRepositoryFile , expandEnv , absolutePrefix (rootPath ))
127
- i .FromPasswordFile = fixPath (i .FromPasswordFile , expandEnv , absolutePrefix (rootPath ))
126
+ i .FromRepositoryFile = fixPath (i .FromRepositoryFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
127
+ i .FromPasswordFile = fixPath (i .FromPasswordFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
128
+ i .FromRepository .setValue (fixPath (i .FromRepository .Value (), expandEnv , expandUserHome ))
128
129
}
129
130
130
131
func (i * InitSection ) getCommandFlags (profile * Profile ) (flags * shell.Args ) {
@@ -184,10 +185,10 @@ func (b *BackupSection) resolve(p *Profile) {
184
185
func (s * BackupSection ) setRootPath (p * Profile , rootPath string ) {
185
186
s .SendMonitoringSections .setRootPath (p , rootPath )
186
187
187
- s .ExcludeFile = fixPaths (s .ExcludeFile , expandEnv , absolutePrefix (rootPath ))
188
- s .FilesFrom = fixPaths (s .FilesFrom , expandEnv , absolutePrefix (rootPath ))
189
- s .Exclude = fixPaths (s .Exclude , expandEnv )
190
- s .Iexclude = fixPaths (s .Iexclude , expandEnv )
188
+ s .ExcludeFile = fixPaths (s .ExcludeFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
189
+ s .FilesFrom = fixPaths (s .FilesFrom , expandEnv , expandUserHome , absolutePrefix (rootPath ))
190
+ s .Exclude = fixPaths (s .Exclude , expandEnv , expandUserHome )
191
+ s .Iexclude = fixPaths (s .Iexclude , expandEnv , expandUserHome )
191
192
}
192
193
193
194
// RetentionSection contains the specific configuration to
@@ -259,8 +260,9 @@ func (s *CopySection) IsEmpty() bool { return s == nil }
259
260
func (c * CopySection ) setRootPath (p * Profile , rootPath string ) {
260
261
c .SendMonitoringSections .setRootPath (p , rootPath )
261
262
262
- c .PasswordFile = fixPath (c .PasswordFile , expandEnv , absolutePrefix (rootPath ))
263
- c .RepositoryFile = fixPath (c .RepositoryFile , expandEnv , absolutePrefix (rootPath ))
263
+ c .PasswordFile = fixPath (c .PasswordFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
264
+ c .RepositoryFile = fixPath (c .RepositoryFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
265
+ c .Repository .setValue (fixPath (c .Repository .Value (), expandEnv , expandUserHome ))
264
266
}
265
267
266
268
func (s * CopySection ) getInitFlags (profile * Profile ) * shell.Args {
@@ -357,7 +359,7 @@ type SendMonitoringSections struct {
357
359
func (s * SendMonitoringSections ) setRootPath (_ * Profile , rootPath string ) {
358
360
for _ , monitoringSections := range s .getAllSendMonitoringSections () {
359
361
for index , value := range monitoringSections {
360
- monitoringSections [index ].BodyTemplate = fixPath (value .BodyTemplate , expandEnv , absolutePrefix (rootPath ))
362
+ monitoringSections [index ].BodyTemplate = fixPath (value .BodyTemplate , expandEnv , expandUserHome , absolutePrefix (rootPath ))
361
363
}
362
364
}
363
365
}
@@ -489,11 +491,12 @@ func (p *Profile) SetResticVersion(resticVersion string) (err error) {
489
491
// SetRootPath changes the path of all the relative paths and files in the configuration
490
492
func (p * Profile ) SetRootPath (rootPath string ) {
491
493
p .Lock = fixPath (p .Lock , expandEnv , absolutePrefix (rootPath ))
492
- p .PasswordFile = fixPath (p .PasswordFile , expandEnv , absolutePrefix (rootPath ))
493
- p .RepositoryFile = fixPath (p .RepositoryFile , expandEnv , absolutePrefix (rootPath ))
494
- p .CacheDir = fixPath (p .CacheDir , expandEnv , absolutePrefix (rootPath ))
495
- p .CACert = fixPath (p .CACert , expandEnv , absolutePrefix (rootPath ))
496
- p .TLSClientCert = fixPath (p .TLSClientCert , expandEnv , absolutePrefix (rootPath ))
494
+ p .PasswordFile = fixPath (p .PasswordFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
495
+ p .RepositoryFile = fixPath (p .RepositoryFile , expandEnv , expandUserHome , absolutePrefix (rootPath ))
496
+ p .Repository .setValue (fixPath (p .Repository .Value (), expandEnv , expandUserHome ))
497
+ p .CacheDir = fixPath (p .CacheDir , expandEnv , expandUserHome , absolutePrefix (rootPath ))
498
+ p .CACert = fixPath (p .CACert , expandEnv , expandUserHome , absolutePrefix (rootPath ))
499
+ p .TLSClientCert = fixPath (p .TLSClientCert , expandEnv , expandUserHome , absolutePrefix (rootPath ))
497
500
498
501
// Forward to sections accepting paths
499
502
for _ , s := range GetSectionsWith [relativePath ](p ) {
@@ -513,7 +516,7 @@ func (p *Profile) SetRootPath(rootPath string) {
513
516
if paths , ok := stringifyValueOf (section [flag ]); ok && len (paths ) > 0 {
514
517
for i , path := range paths {
515
518
if len (path ) > 0 {
516
- paths [i ] = fixPath (path , expandEnv , absolutePrefix (rootPath ))
519
+ paths [i ] = fixPath (path , expandEnv , expandUserHome , absolutePrefix (rootPath ))
517
520
}
518
521
}
519
522
section [flag ] = paths
0 commit comments