From 84c967de98d8d360a6ea26a2b8cffc36af5664c5 Mon Sep 17 00:00:00 2001 From: kirsn Date: Wed, 21 Jan 2015 23:35:56 +0530 Subject: [PATCH] Issue 2035: Fix the caching on Windows - issue with filenames greater than 256 chars --- gluon/cache.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gluon/cache.py b/gluon/cache.py index 671abe7e..60b31351 100644 --- a/gluon/cache.py +++ b/gluon/cache.py @@ -282,6 +282,17 @@ class CacheOnDisk(CacheAbstract): ] def replace_windows(src, dst): + """ + The Windows filesystem has a 256 character limit for the filename. + To use filenames longer than that, the '\\?\' prefix needs to be used. + By default, this prefix is added to all windows filenames, + when accessing it. + View this for details: http://stackoverflow.com/a/23230380/348142 + """ + windows_prefix = "\\\\?\\" + dst = windows_prefix + dst + src = windows_prefix + src + if not ReplaceFile(dst, src, None, 0, 0, 0): os.rename(src, dst)