diff options
Diffstat (limited to 'config_file')
| -rw-r--r-- | config_file/__init__.py | 2 | ||||
| -rw-r--r-- | config_file/config_file.py | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/config_file/__init__.py b/config_file/__init__.py index 22164c1..5917edd 100644 --- a/config_file/__init__.py +++ b/config_file/__init__.py @@ -1,7 +1,7 @@ from config_file.config_file import ConfigFile from config_file.parsers.base_parser import BaseParser, ParsingError -__version__ = "0.5.0" +__version__ = "0.6.0" __all__ = [ "ConfigFile", 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() |