X-Git-Url: https://v.licheni.net/stack/code/dboxswitch.git/blobdiff_plain/6387024f16be8f34ace846b605a8cf05938cd849..45c3190a53e28bc5c9375794a8b154356f30ae50:/profhandler.py diff --git a/profhandler.py b/profhandler.py index 19a6b97..c1a30e8 100755 --- a/profhandler.py +++ b/profhandler.py @@ -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: @@ -122,8 +133,6 @@ class ProfHandler(): if ppath in self.getProfilesList(): self.stopDropbox() try: - print self.getDropboxDirectory() - print ppath if pl in ('Linux','Darwin'): if os.path.exists(self.getDropboxDirectory()): os.unlink(self.getDropboxDirectory()) @@ -149,6 +158,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: