- manifest_path = os.path.join(dest_dir, manifest_file)
- f = open(manifest_path, "w")
- f.write(data)
- f.close()
+ if not os.path.exists(dest_dir):
+ os.mkdir(dest_dir, 0755)
+
+ # Remove the querystring if present
+ manifest_url = urlunparse(urlparse(url)._replace(query=''))
+
+ if not manifest_url.lower().endswith(('/manifest', '.ismc', '.csm')):
+ manifest_url += '/Manifest'
+
+ if manifest_url.startswith('http://'):
+ local_manifest_path = os.path.join(dest_dir, 'Manifest')
+ download_file(manifest_url, local_manifest_path, "w")