From 8a22d1fa93ab8cffb6217779af3a7b49f9982934 Mon Sep 17 00:00:00 2001 From: leafee98 Date: Fri, 31 Mar 2023 16:57:56 +0800 Subject: [PATCH] Check existence before remove symlink when deploying --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 11f4a25..6560f4e 100755 --- a/main.py +++ b/main.py @@ -118,7 +118,8 @@ class FileManager: return False self.logger.info("Recreating symlink point to {}".format(extract_dir)) - os.remove(self.symlink_path) + if Path(self.symlink_path).exists(): + os.remove(self.symlink_path) os.symlink(extract_dir, self.symlink_path) return True