From 85bdb2d9a93778658ac0957c8af718bca465351d Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 29 Jul 2009 10:49:09 -0600 Subject: [PATCH] Fix #2808 (PRS-505 upload does not handle long titles well) --- src/calibre/devices/usbms/cli.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/calibre/devices/usbms/cli.py b/src/calibre/devices/usbms/cli.py index d31b26d5f4..9438db5952 100644 --- a/src/calibre/devices/usbms/cli.py +++ b/src/calibre/devices/usbms/cli.py @@ -37,6 +37,9 @@ class CLI(object): path = os.path.join(path, infile.name) if not replace_file and os.path.exists(path): raise PathError('File already exists: ' + path) + d = os.path.dirname(path) + if not os.path.exists(d): + os.makedirs(d) dest = open(path, 'wb') shutil.copyfileobj(infile, dest, 10*1024*1024) dest.flush()