From 8d2a31e38e6f106ac404bdd48cc8c09e6ec1e001 Mon Sep 17 00:00:00 2001 From: Adel Qalieh Date: Sat, 7 Jan 2017 17:05:30 +0000 Subject: [PATCH] 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 --- lib/model/model.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/model/model.go b/lib/model/model.go index b6267a2f5..355333923 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -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)