ADD: While in configuration of Lua library location, if after a modification of it the configured Lua library location doesn't work, report it to user immediately.

ADD: Still to help new user, if user attempts to add a Lua script based WDX plugin and there is a problem attempting to load Lua library, report to user the proper message about the library loading error instead of reporting that the plugin is invalid.
ADD: In the above scenario, offer to switch to Lua library location configuration tab if library can't be loaded.
This commit is contained in:
Denis Bisson 2019-04-03 00:43:00 +00:00
commit 54cd8ffc85
2 changed files with 10 additions and 4 deletions

View file

@ -74,7 +74,7 @@ uses
Controls, Forms,
//DC
fOptionsPluginsBase, uDebug, lua, uWDXModule,
uShowMsg, fOptionsPluginsBase, uDebug, lua, uWDXModule,
uGlobs, uDCUtils, uSpecialDir, uLng, uDefaultPlugins, fOptions,
fOptionsPluginsDSX, fOptionsPluginsWCX, fOptionsPluginsWDX,
fOptionsPluginsWFX, fOptionsPluginsWLX;
@ -123,7 +123,7 @@ begin
TLuaWdx(gWDXPlugins.GetWdxModule(iIndexPlugin)).UnloadModule;
UnloadLuaLib;
gLuaLib := fneLuaLibraryFilename.FileName;
LoadLuaLib(mbExpandFileName(gLuaLib));
if not LoadLuaLib(mbExpandFileName(gLuaLib)) then MsgError(Format(rsMsgScriptCantFindLibrary, [gLuaLib]));
Include(FResultForWhenWeExit, oesfNeedsRestart);
end;
Result := FResultForWhenWeExit;

View file

@ -63,7 +63,7 @@ uses
LCLProc, Forms, Dialogs,
//DC
uLng, uGlobs, dmCommonData, DCStrUtils, uDefaultPlugins;
uShowMsg, fOptions, lua, uLng, uGlobs, dmCommonData, DCStrUtils, uDefaultPlugins;
const
COLNO_NAME = 0;
@ -171,7 +171,13 @@ begin
if not tmpWDXPlugins.LoadModule(pred(tmpWDXPlugins.Count)) then
begin
MessageDlg(Application.Title, rsMsgInvalidPlugin, mtError, [mbOK], 0, mbOK);
if tmpWDXPlugins.GetWdxModule(pred(tmpWDXPlugins.Count)).ClassNameIs('TLuaWdx') and (not IsLuaLibLoaded) then
begin
if msgYesNo(Format(rsMsgScriptCantFindLibrary, [gLuaLib]) + #$0A + rsMsgWantToConfigureLibraryLocation) then
ShowOptions('TfrmOptionsPluginsGroup');
end
else
MessageDlg(Application.Title, rsMsgInvalidPlugin, mtError, [mbOK], 0, mbOK);
tmpWDXPlugins.DeleteItem(I);
Exit;
end;