mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Fix regression that broke ebook-device cp
This commit is contained in:
parent
a33b6098f7
commit
37b6242c3f
@ -286,7 +286,7 @@ def main():
|
|||||||
usage="usage: %prog cp [options] source destination\nCopy files to/from the device\n\n"+\
|
usage="usage: %prog cp [options] source destination\nCopy files to/from the device\n\n"+\
|
||||||
"One of source or destination must be a path on the device. \n\nDevice paths have the form\n"+\
|
"One of source or destination must be a path on the device. \n\nDevice paths have the form\n"+\
|
||||||
"dev:mountpoint/my/path\n"+\
|
"dev:mountpoint/my/path\n"+\
|
||||||
"where mountpoint is one of / or card:/\n\n"+\
|
"where mountpoint is one of / or carda: or cardb:/\n\n"+\
|
||||||
"source must point to a file for which you have read permissions\n"+\
|
"source must point to a file for which you have read permissions\n"+\
|
||||||
"destination must point to a file or directory for which you have write permissions"
|
"destination must point to a file or directory for which you have write permissions"
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
@ -298,7 +298,7 @@ def main():
|
|||||||
return 1
|
return 1
|
||||||
if args[0].startswith("dev:"):
|
if args[0].startswith("dev:"):
|
||||||
outfile = args[1]
|
outfile = args[1]
|
||||||
path = args[0][7:]
|
path = args[0][4:]
|
||||||
if path.endswith("/"):
|
if path.endswith("/"):
|
||||||
path = path[:-1]
|
path = path[:-1]
|
||||||
if os.path.isdir(outfile):
|
if os.path.isdir(outfile):
|
||||||
@ -320,11 +320,11 @@ def main():
|
|||||||
parser.print_help()
|
parser.print_help()
|
||||||
return 1
|
return 1
|
||||||
try:
|
try:
|
||||||
dev.put_file(infile, args[1][7:])
|
dev.put_file(infile, args[1][4:])
|
||||||
except PathError as err:
|
except PathError as err:
|
||||||
if options.force and 'exists' in str(err):
|
if options.force and 'exists' in str(err):
|
||||||
dev.del_file(err.path, False)
|
dev.del_file(err.path, False)
|
||||||
dev.put_file(infile, args[1][7:])
|
dev.put_file(infile, args[1][4:])
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
infile.close()
|
infile.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user