Skip to content
Snippets Groups Projects
Commit b917733a authored by Alan De Smet's avatar Alan De Smet
Browse files

Fix warning message typo; don't symlink onto self

symlinking onto self is a danger when doing downloads directly into the
run directory.
parent 648be010
Branches
No related tags found
No related merge requests found
#! /home/adesmet/csppfetch/example/venv/bin/python3
#! /usr/bin/python3 #! /usr/bin/python3
# System modules # System modules
...@@ -74,7 +75,7 @@ def main(): ...@@ -74,7 +75,7 @@ def main():
cache_dir = args.dir cache_dir = args.dir
if not os.access(cache_dir, os.W_OK): if not os.access(cache_dir, os.W_OK):
logging.warning(f'I do not appear to be able to have write access to "{cache_dir}". Downloading directly into args.destination') logging.warning(f'I do not appear to be able to have write access to "{cache_dir}". Downloading directly into {args.destination}')
args.dir = args.destination args.dir = args.destination
do_download = not args.cache_only do_download = not args.cache_only
...@@ -104,7 +105,8 @@ def main(): ...@@ -104,7 +105,8 @@ def main():
dst_dir = os.path.dirname(dst) dst_dir = os.path.dirname(dst)
os.makedirs(dst_dir, exist_ok=True) os.makedirs(dst_dir, exist_ok=True)
logging.info(src + ' -> ' + dst) logging.info(src + ' -> ' + dst)
os.symlink(src, dst) if src != dst:
os.symlink(src, dst)
except csppfetch.DownloadsFailedException as e: except csppfetch.DownloadsFailedException as e:
logging.fatal(str(e)) logging.fatal(str(e))
......
#! /usr/bin/python3 #! /home/adesmet/csppfetch/example/venv/bin/python3
# System modules # System modules
import os import os
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment