提交 7aa11973 编写于 作者: K Kaipeng Deng 提交者: qingqing01

fix download.py windows compatible (#15)

上级 744cb882
......@@ -154,7 +154,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:
......@@ -186,7 +186,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:
......@@ -247,7 +247,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
......@@ -314,7 +314,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.
先完成此消息的编辑!
想要评论请 注册