When running calibre-portable.exe popup a more useful error message if it is placed in a location with a too long path. Fixes #1866739 [Path length for calibre portable](https://bugs.launchpad.net/calibre/+bug/1866739)

This commit is contained in:
Kovid Goyal 2020-03-25 13:08:54 +05:30
parent ac12d5933a
commit f6f418fcb0
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -85,6 +85,12 @@ LPTSTR get_app_dir() {
} }
_sntprintf_s(buf3, BUFSIZE-1, _TRUNCATE, _T("%s%s"), drive, buf2); _sntprintf_s(buf3, BUFSIZE-1, _TRUNCATE, _T("%s%s"), drive, buf2);
if (_tcslen(buf3) > 58) {
_snwprintf_s(buf, 4*MAX_PATH, _TRUNCATE,
L"Path to Calibre Portable (%s) too long. Must be less than 59 characters.", buf3);
show_error(buf);
ExitProcess(1);
}
free(buf); free(buf2); free(buf); free(buf2);
return buf3; return buf3;
} }
@ -150,5 +156,3 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
return 0; return 0;
} }