Updated for exception

This commit is contained in:
Dimitris Zlatanidis 2023-04-30 21:42:28 +03:00
parent e0f8789061
commit 7e125ecc1b

View file

@ -53,8 +53,12 @@ class Downloader(Configs):
filename: str = unquote(Path(path).name)
if url.startswith('file'):
shutil.copy2(Path(url.replace('file:', '')), self.tmp_slpkg)
print(f"{self.byellow}Copying{self.endc}: {Path(url.replace('file:', ''))} -> {self.tmp_slpkg}\n")
try:
shutil.copy2(Path(url.replace('file:', '')), self.tmp_slpkg)
print(f"{self.byellow}Copying{self.endc}: {Path(url.replace('file:', ''))} -> {self.tmp_slpkg}")
except FileNotFoundError as error:
self.errors.raise_error_message(f'{error}', 20)
else:
if self.downloader in ['wget', 'wget2']:
command: str = f'{self.downloader} {self.wget_options} --directory-prefix={self.path} "{url}"'