From 73df11e69eeadf0222818154ee53c383aa8c0b07 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 24 Oct 2020 09:02:56 +0530 Subject: [PATCH] Mark calibre as long path aware on Windows Python 3.8 is supposedly long path aware and calibre itself does not use MAX_PATH except in a few functions in the launcher/installer, and a couple in winutil. So hopefully this means we are long path capable. --- bypy/windows/__main__.py | 19 +++++++++++-------- src/calibre/utils/windows/winutil.cpp | 7 ++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/bypy/windows/__main__.py b/bypy/windows/__main__.py index 1d9b72fa7b..93814ed986 100644 --- a/bypy/windows/__main__.py +++ b/bypy/windows/__main__.py @@ -66,7 +66,7 @@ SUPPORTED_OS = { EXE_MANIFEST = '''\ - + @@ -75,14 +75,17 @@ EXE_MANIFEST = '''\ - - - - - - + + + + + + + true + + - + '''.format(**SUPPORTED_OS) diff --git a/src/calibre/utils/windows/winutil.cpp b/src/calibre/utils/windows/winutil.cpp index 10152dcd4d..4c70a958e5 100644 --- a/src/calibre/utils/windows/winutil.cpp +++ b/src/calibre/utils/windows/winutil.cpp @@ -351,12 +351,9 @@ winutil_username(PyObject *self) { static PyObject * winutil_temp_path(PyObject *self) { - wchar_t buf[MAX_PATH + 1] = {0}; + wchar_t buf[MAX_PATH + 8] = {0}; DWORD sz = sizeof(buf)/sizeof(buf[0]); - if (!GetTempPath(sz, buf)) { - PyErr_SetFromWindowsErr(0); - return NULL; - } + if (!GetTempPathW(sz, buf)) return PyErr_SetFromWindowsErr(0); return PyUnicode_FromWideChar(buf, -1); }