Raise error before LoadLibrary is called, when library file does not exist, so the user gets a more reasonable message

This commit is contained in:
Ansgar Becker
2019-07-26 20:48:18 +02:00
parent 53b8f544c2
commit 13fa85e567
2 changed files with 11 additions and 3 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: HeidiSQL\n" "Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n" "POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2019-07-23 21:57+0200\n" "PO-Revision-Date: 2019-07-26 20:47+0200\n"
"Last-Translator: Ansgar Becker <anse@heidisql.com>\n" "Last-Translator: Ansgar Becker <anse@heidisql.com>\n"
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n" "Language-Team: English (http://www.transifex.com/projects/p/heidisql/language/en/)\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -4039,8 +4039,8 @@ msgid "Library %s seems unusable. Please select a different one."
msgstr "Library %s seems unusable. Please select a different one." msgstr "Library %s seems unusable. Please select a different one."
#: dbconnection.pas:1392 #: dbconnection.pas:1392
msgid "Cannot find a usable %s. Please launch %s from the directory where you have installed it." msgid "Please launch %s from the directory where you have installed it. Or just reinstall %s."
msgstr "Cannot find a usable %s. Please launch %s from the directory where you have installed it." msgstr "Please launch %s from the directory where you have installed it. Or just reinstall %s."
msgid "Internal error %d: %s" msgid "Internal error %d: %s"
msgstr "Internal error %d: %s" msgstr "Internal error %d: %s"

View File

@ -7670,6 +7670,14 @@ begin
// Load DLL as is (with or without path) // Load DLL as is (with or without path)
inherited Create; inherited Create;
FDllFile := DllFile; FDllFile := DllFile;
if not FileExists(FDllFile) then begin
msg := f_('File does not exist: %s', [FDllFile]) +
sLineBreak + sLineBreak +
f_('Please launch %s from the directory where you have installed it. Or just reinstall %s.', [APPNAME, APPNAME]
);
Raise EdbError.Create(msg);
end;
FHandle := LoadLibrary(PWideChar(FDllFile)); FHandle := LoadLibrary(PWideChar(FDllFile));
if FHandle = 0 then begin if FHandle = 0 then begin
msg := f_('Library %s could not be loaded. Please select a different one.', msg := f_('Library %s could not be loaded. Please select a different one.',