From ae2b1592dc1b41e476ce5e896c3f3f7a52cc2901 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 17 Jan 2011 04:56:17 +0900 Subject: [PATCH] don't die if a user redownloads a disabled plugin --- ankiqt/ui/main.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 7a00f35ab..71b02345d 100755 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -2694,7 +2694,10 @@ to work with this version of Anki.""")) for p in plugins: path = os.path.join(dir, p[0]) if os.path.exists(path): - os.rename(path, path.replace(".py", ".disabled")) + new = path.replace(".py", ".disabled") + if os.path.exists(new): + os.unlink(new) + os.rename(path, new) ui.utils.showInfo(p[1]) def rebuildPluginsMenu(self):