From 4bfadae57f4ff761911e6421db0b1c5887d74f80 Mon Sep 17 00:00:00 2001
From: David Stainton <dstainton415@gmail.com>
Date: Thu, 5 Nov 2015 17:09:17 +0100
Subject: [PATCH] Teach join to also check for existing magicfolder db file

---
 src/allmydata/scripts/magic_folder_cli.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/scripts/magic_folder_cli.py b/src/allmydata/scripts/magic_folder_cli.py
index 245a9b6a..7b63a70d 100644
--- a/src/allmydata/scripts/magic_folder_cli.py
+++ b/src/allmydata/scripts/magic_folder_cli.py
@@ -152,8 +152,9 @@ def join(options):
 
     dmd_cap_file = os.path.join(options["node-directory"], u"private", u"magic_folder_dircap")
     collective_readcap_file = os.path.join(options["node-directory"], u"private", u"collective_dircap")
+    magic_folder_db_file = os.path.join(options["node-directory"], u"private", u"magicfolderdb.sqlite")
 
-    if os.path.exists(dmd_cap_file) or os.path.exists(collective_readcap_file):
+    if os.path.exists(dmd_cap_file) or os.path.exists(collective_readcap_file) or os.path.exists(magic_folder_db_file):
         raise usage.UsageError("Cannot join. Already joined.")
 
     fileutil.write(dmd_cap_file, dmd_write_cap)
-- 
2.45.2