mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
Perform tilde expansion in the config wrapper
This commit is contained in:
parent
838670ccbc
commit
a5fe4a3694
@ -575,17 +575,11 @@ func setupGUI(cfg *config.ConfigWrapper, m *model.Model) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func sanityCheckFolders(cfg *config.ConfigWrapper, m *model.Model) {
|
func sanityCheckFolders(cfg *config.ConfigWrapper, m *model.Model) {
|
||||||
var err error
|
|
||||||
|
|
||||||
nextFolder:
|
nextFolder:
|
||||||
for id, folder := range cfg.Folders() {
|
for id, folder := range cfg.Folders() {
|
||||||
if folder.Invalid != "" {
|
if folder.Invalid != "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
folder.Path, err = osutil.ExpandTilde(folder.Path)
|
|
||||||
if err != nil {
|
|
||||||
l.Fatalln("home:", err)
|
|
||||||
}
|
|
||||||
m.AddFolder(folder)
|
m.AddFolder(folder)
|
||||||
|
|
||||||
fi, err := os.Stat(folder.Path)
|
fi, err := os.Stat(folder.Path)
|
||||||
|
@ -377,7 +377,7 @@ func convertV5V6(cfg *Configuration) {
|
|||||||
// Added ".stfolder" file at folder roots to identify mount issues
|
// Added ".stfolder" file at folder roots to identify mount issues
|
||||||
// Doesn't affect the config itself, but uses config migrations to identify
|
// Doesn't affect the config itself, but uses config migrations to identify
|
||||||
// the migration point.
|
// the migration point.
|
||||||
for _, folder := range cfg.Folders {
|
for _, folder := range Wrap("", *cfg).Folders() {
|
||||||
err := folder.CreateMarker()
|
err := folder.CreateMarker()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -167,6 +167,12 @@ func (w *ConfigWrapper) Folders() map[string]FolderConfiguration {
|
|||||||
if w.folderMap == nil {
|
if w.folderMap == nil {
|
||||||
w.folderMap = make(map[string]FolderConfiguration, len(w.cfg.Folders))
|
w.folderMap = make(map[string]FolderConfiguration, len(w.cfg.Folders))
|
||||||
for _, fld := range w.cfg.Folders {
|
for _, fld := range w.cfg.Folders {
|
||||||
|
path, err := osutil.ExpandTilde(fld.Path)
|
||||||
|
if err != nil {
|
||||||
|
l.Warnln("home:", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
fld.Path = path
|
||||||
w.folderMap[fld.ID] = fld
|
w.folderMap[fld.ID] = fld
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user