for f in files:
fpath = path.join(top, f)
if path.isfile(fpath):
- yield open(fpath, 'rb'), '%s/%s' % (rel_path, f)
+ rel_path = rel_path.replace(path.sep, '/')
+ pathfix = f.replace(path.sep, '/')
+ yield open(fpath, 'rb'), '%s/%s' % (rel_path, pathfix)
else:
print('%s is not a regular file' % fpath)
else:
try:
robj = self.client.get_object_info(rpath)
if remote_path and self._is_dir(robj):
- rpath += '/%s' % short_path
+ rpath += '/%s' % (short_path.replace(path.sep, '/'))
self.client.get_object_info(rpath)
if not self['overwrite']:
raiseCLIError(
raiseCLIError(
'Illegal download: Remote object %s is a directory' % (
self.path),
- details=['To download a directory, try --recursive'])
+ details=['To download a directory, try --recursive or -R'])
if '/' in self.path.strip('/') and not local_path:
raiseCLIError(
'Illegal download: remote object %s contains "/"' % (
if self.path:
raiseCLIError(
'No matching path %s on container %s' % (
- self.path,
- self.container),
+ self.path, self.container),
details=[
'To list the contents of %s, try:' % self.container,
' /file list %s' % self.container])
lprefix = path.abspath(local_path or path.curdir)
if path.isdir(lprefix):
for rpath, remote_is_dir in remotes:
- lpath = '/%s/%s' % (lprefix.strip('/'), rpath.strip('/'))
+ lpath = path.sep.join([
+ lprefix[:-1] if lprefix.endswith(path.sep) else lprefix,
+ rpath.strip('/').replace('/', path.sep)])
if remote_is_dir:
if path.exists(lpath) and path.isdir(lpath):
continue