lib/model: Use factories for creating folders

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3029
This commit is contained in:
Audrius Butkevicius
2016-05-04 10:47:33 +00:00
committed by Jakob Borg
parent 6720906ee5
commit eabd2fc936
13 changed files with 84 additions and 82 deletions

View File

@@ -23,6 +23,9 @@ const (
OldestHandledVersion = 10
CurrentVersion = 13
MaxRescanIntervalS = 365 * 24 * 60 * 60
FolderTypeReadWrite = "readwrite"
FolderTypeReadOnly = "readonly"
)
var (
@@ -247,6 +250,15 @@ func convertV12V13(cfg *Configuration) {
cfg.Options.NATRenewalM = cfg.Options.DeprecatedUPnPRenewalM
cfg.Options.NATTimeoutS = cfg.Options.DeprecatedUPnPTimeoutS
cfg.Version = 13
for i, fcfg := range cfg.Folders {
if fcfg.DeprecatedReadOnly {
cfg.Folders[i].Type = FolderTypeReadOnly
} else {
cfg.Folders[i].Type = FolderTypeReadWrite
}
cfg.Folders[i].DeprecatedReadOnly = false
}
}
func convertV11V12(cfg *Configuration) {