aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config_file/config_file.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/config_file/config_file.py b/config_file/config_file.py
index b090ace..5827d08 100644
--- a/config_file/config_file.py
+++ b/config_file/config_file.py
@@ -118,7 +118,11 @@ class ConfigFile:
if not Path(original_file_path).exists():
raise OSError(f"The {original_file_path} file to reset to does not exist.")
- Path(self.path).expanduser().unlink(missing_ok=True)
+ try:
+ Path(self.path).expanduser().unlink()
+ except OSError:
+ pass
+
copyfile(original_file_path, self.path)
self.contents = self.__read_config_file()