From 3c36e87b86a3da162c7bca813b956a08d3ad292a Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Tue, 18 Sep 2012 13:02:15 +0200 Subject: [PATCH] Improve the path fudge factor stuff. --- src/calibre/devices/smart_device_app/driver.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 71805b8692..4befe970d5 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -188,10 +188,16 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): NEWS_IN_FOLDER = True SUPPORTS_USE_AUTHOR_SORT = False WANTS_UPDATED_THUMBNAILS = True - MAX_PATH_LEN = 250 + NOT_WINDOWS_MAX_PATH_LEN = 250 + + # Guess about the max length on windows. This number will be reduced by + # the length of the path on the client, and by the fudge factor below + WINDOWS_MAX_PATH_LEN = 250 # guess of length of MTP name. The length of the full path to the folder # on the device is added to this. That path includes device the mount point. - WINDOWS_PATH_FUDGE_FACTOR = 25 + # making this number effectively around 10 to 15 larger. + WINDOWS_PATH_FUDGE_FACTOR = 40 + THUMBNAIL_HEIGHT = 160 PREFIX = '' BACKLOADING_ERROR_MESSAGE = None @@ -364,7 +370,10 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): ext = os.path.splitext(fname)[1] if iswindows: - maxlen = 225 - max(25, self.exts_path_lengths.get(ext, 25)) + maxlen = (self.WINDOWS_MAX_PATH_LEN - + (self.WINDOWS_PATH_FUDGE_FACTOR + + self.exts_path_lengths.get(ext, + self.WINDOWS_PATH_FUDGE_FACTOR))) else: maxlen = self.MAX_PATH_LEN