stop sync in linux before killing daemon
[stack/code/dboxswitch.git] / profhandler.py
index 19a6b97..18dda25 100755 (executable)
@@ -111,7 +111,18 @@ class ProfHandler():
             raise AppError('Profile Name not valid')
         print("Profile "+profileName+" created.")
 
+    def isCurrentProfile(self, ppath):
+        """ Returns true if the current profile path is currently activated """
+        
+        pl = platform.system()
+        if pl in ('Linux','Darwin'):
+            if os.path.exists(self.getDropboxDirectory()):
+                return True if os.readlink(self.getDropboxDirectory()) == ppath else False
+            else:
+                return False
+
     def isValidProfileName(self, pname):
+
         if self.reg.match(pname) is not None:
             return True
         else:
@@ -149,6 +160,8 @@ class ProfHandler():
     def stopDropbox(self):
         """ Stop dropbox Daemon """
         pl = platform.system()
+        if pl == 'Linux':
+            os.system("dropbox stop")
         if pl in ('Linux','Darwin'):
             pidfile = os.path.expanduser("~/.dropbox/dropbox.pid")                    
             try: