1 Commits
3.4.0 ... 3.4.1

Author SHA1 Message Date
4d23bde906 Check that inputs from command line exist
Check that the inputs specified on the command line (i.e. with the
option '-i' or '--input') exist and print a warning when they don't.
If no valid inputs are found, exit.
2023-06-15 18:44:22 +02:00
2 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,3 @@
"""Init."""
__version__ = '3.4.0'
__version__ = '3.4.1'

View File

@ -186,12 +186,28 @@ class Backup:
self.create_backup_dir()
_, self._inputs_path = mkstemp(prefix='tmp_inputs', text=True)
_, self._exclude_path = mkstemp(prefix='tmp_exclude', text=True)
count = 0
with open(self._inputs_path, 'w') as fp:
for i in self.inputs:
fp.write(i)
fp.write('\n')
if not os.path.exists(i):
logger.warning(f'Input {i} not found. Skipping')
else:
fp.write(i)
fp.write('\n')
count += 1
if count == 0:
logger.info('No existing files or directories specified for backup. Nothing to do')
try:
notify('Backup finished. No files copied')
except NameError:
pass
return 1
_, self._exclude_path = mkstemp(prefix='tmp_exclude', text=True)
with open(self._exclude_path, 'w') as fp:
if self.exclude is not None: