From: stack Date: Tue, 23 Sep 2014 18:23:00 +0000 (+0200) Subject: fix profile switching X-Git-Url: https://v.licheni.net/stack/code/dboxswitch.git/commitdiff_plain/45988c8bde46e2e882825620c2809b7b844f634b?ds=inline;hp=2520291a845ff27b74046a996ca47a81a8ed5717 fix profile switching --- diff --git a/dboxswitch/gui.py b/dboxswitch/gui.py index ae2c3c8..70485f7 100644 --- a/dboxswitch/gui.py +++ b/dboxswitch/gui.py @@ -48,7 +48,7 @@ class Gui(QtGui.QDialog): Default actions are builded and profile manager stored from argument (instance of ProfHandler """ self.app = QtGui.QApplication(sys.argv) - for i in range(3): + for i in range(23): if not QtGui.QSystemTrayIcon.isSystemTrayAvailable(): sleep(4) else: diff --git a/dboxswitch/profhandler.py b/dboxswitch/profhandler.py index 8802f1f..a17b57a 100644 --- a/dboxswitch/profhandler.py +++ b/dboxswitch/profhandler.py @@ -140,9 +140,10 @@ class ProfHandler(): self.stopDropbox() try: if pl in ('Linux','Darwin'): - if os.path.exists(self.getDropboxDirectory()): - os.unlink(self.getDropboxDirectory()) - os.symlink(ppath, self.getDropboxDirectory()) + dbdir = self.getDropboxDirectory() + if os.path.exists(dbdir): + os.unlink(dbdir) + os.symlink(ppath, dbdir) else: raise NotImplementedError, "Not implemented yet." except IOError as e: @@ -161,7 +162,7 @@ class ProfHandler(): if pl in ('Linux', 'Darwin'): basepath = os.path.join(os.path.expanduser("~"), ".dropbox") for path in [os.path.join(basepath, "instance1"), basepath]: - if os.path.exists(path): + if os.path.exists(path) and os.path.islink(path): return path raise NotImplementedError("Path not found " + basepath + "[instance1]") elif pl == 'Windows':