lib/model: Remove syncthing-specific files (fixes #3819)

Syncthing adds some hidden files when a folder is added, but there is currently
no equivalent cleanup procedure. This change is conservative as not to
accidentally cause data loss.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3874
This commit is contained in:
Adel Qalieh 2017-01-07 17:05:30 +00:00 committed by Jakob Borg
parent fe377a166a
commit 8d2a31e38e

View File

@ -330,6 +330,11 @@ func (m *Model) RemoveFolder(folder string) {
m.fmut.Lock()
m.pmut.Lock()
// Delete syncthing specific files
folderCfg := m.folderCfgs[folder]
folderPath := folderCfg.Path()
os.Remove(filepath.Join(folderPath, ".stfolder"))
m.tearDownFolderLocked(folder)
// Remove it from the database
db.DropFolder(m.db, folder)