CLI: Tidy up single_location handling

This commit is contained in:
Mike Auty
2021-03-04 23:25:53 +00:00
parent 1d35406ffe
commit 2fe7e22bf8
+2 -1
View File
@@ -273,7 +273,8 @@ class CommandLine:
single_location = urllib.parse.urlparse(args.file, 'file')
if single_location.scheme == 'file' or len(single_location.scheme) == 1:
# Otherwise construct a URL parameter
single_location = urllib.parse.urlparse(urllib.parse.urljoin('file:', request.pathname2url(os.path.abspath(args.file))))
file_path = request.pathname2url(os.path.abspath(args.file))
single_location = urllib.parse.urlparse(urllib.parse.urljoin('file:', file_path))
if not os.path.exists(single_location.path):
parser.error("File does not exist: {}".format(single_location.path))
ctx.config['automagic.LayerStacker.single_location'] = urllib.parse.urlunparse(single_location)