未验证 提交 7b61c39b 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix download windows compatable (#3859)

上级 ed1cb0ce
......@@ -150,7 +150,7 @@ def create_voc_list(data_dir, devkit_subdir='VOCdevkit'):
def map_path(url, root_dir):
# parse path after download to decompress under root_dir
fname = url.split('/')[-1]
fname = osp.split(url)[-1]
zip_formats = ['.zip', '.tar', '.gz']
fpath = fname
for zip_format in zip_formats:
......@@ -182,7 +182,7 @@ def get_path(url, root_dir, md5sum=None, check_exist=True):
}
for k, v in decompress_name_map.items():
if fullpath.find(k) >= 0:
fullpath = '/'.join(fullpath.split('/')[:-1] + [v])
fullpath = osp.join(osp.split(fullpath)[0], v)
exist_flag = False
if osp.exists(fullpath) and check_exist:
......@@ -243,7 +243,7 @@ def _download(url, path, md5sum=None):
if not osp.exists(path):
os.makedirs(path)
fname = url.split('/')[-1]
fname = osp.split(url)[-1]
fullname = osp.join(path, fname)
retry_cnt = 0
......@@ -310,7 +310,7 @@ def _decompress(fname):
# decompress to fpath_tmp directory firstly, if decompress
# successed, move decompress files to fpath and delete
# fpath_tmp and remove download compress file.
fpath = '/'.join(fname.split('/')[:-1])
fpath = osp.split(fname)[0]
fpath_tmp = osp.join(fpath, 'tmp')
if osp.isdir(fpath_tmp):
shutil.rmtree(fpath_tmp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册