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.
This commit is contained in:
Kovid Goyal 2020-10-24 09:02:56 +05:30
parent fee0353451
commit 73df11e69e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 13 deletions

View File

@ -66,7 +66,7 @@ SUPPORTED_OS = {
EXE_MANIFEST = '''\ EXE_MANIFEST = '''\
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security> <security>
<requestedPrivileges> <requestedPrivileges>
@ -75,14 +75,17 @@ EXE_MANIFEST = '''\
</security> </security>
</trustInfo> </trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application> <application xmlns="urn:schemas-microsoft-com:asm.v3">
<supportedOS Id="{w7}"/> <supportedOS Id="{w7}"/>
<supportedOS Id="{w8}"/> <supportedOS Id="{w8}"/>
<supportedOS Id="{w81}"/> <supportedOS Id="{w81}"/>
<supportedOS Id="{w10}"/> <supportedOS Id="{w10}"/>
</application> <windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</compatibility> </compatibility>
</assembly> </assembly>
'''.format(**SUPPORTED_OS) '''.format(**SUPPORTED_OS)

View File

@ -351,12 +351,9 @@ winutil_username(PyObject *self) {
static PyObject * static PyObject *
winutil_temp_path(PyObject *self) { 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]); DWORD sz = sizeof(buf)/sizeof(buf[0]);
if (!GetTempPath(sz, buf)) { if (!GetTempPathW(sz, buf)) return PyErr_SetFromWindowsErr(0);
PyErr_SetFromWindowsErr(0);
return NULL;
}
return PyUnicode_FromWideChar(buf, -1); return PyUnicode_FromWideChar(buf, -1);
} }