-
Notifications
You must be signed in to change notification settings - Fork 261
Description
Description
When calling plugin_askinstall
from a script with the force
install option set to false, the function executes the following check:
if ~forceInstall
db = dbstack;
if length(db) > 2 && ~strcmpi(db(end).name, 'checkouteeglab.m')
error([ 'Cannot find ' pluginName ' extension, use EEGLAB Extension Manager to install it' ]);
end
...
end
It checks if the the function is either called directly from the command line, from within a script that is directly run, or from a script file named checkouteeglab.m
. However, the stack structure returned by dbstack
is of the format
Fields | file | name | line |
---|---|---|---|
1 | 'plugin_askinstall.m' |
'plugin_askinstall' |
49 |
2 | 'checkouteeglab.m' |
'checkouteeglab' |
9 |
The function checks if the name
field is equal to 'checkouteeglab.m'
, but this will never be true since it is the file
field that ends with the extension .m
.
Furthermore, I am not sure why this check is present in the code. Why should this function with this specific option only be called directly from the command line or from a script named checkouteeglab.m
, a script in the the eeglab-test
repository https://github.com/sccn/eeglab-testcases/blob/master/checkouteeglab.m. I would very much like to create my own automated setup files for my EEGLAB environment and test cases, but this check prevents me from doing that. Finally, the error message thrown (cannot find plugin), does not seem descriptive of the problem at hand.
Steps to Reproduce
Case 1
- Create a script named
checkouteeglab.m
containing
...
plugin_askinstall('biosig', [], false);
...
- Create a second script (e.g.
test.m
) callingcheckouteeglab
- Execute the second script
Case 2
- Create a MATLAB project
- Create a script with a custom name (e.g.
startup.m
) containing
...
plugin_askinstall('biosig', [], false);
...
- Set the script as a MATLAB project startup script
- Open the project causing the script to be run with additional stack trace entries
Expected behavior:
Install Biosig plugin if not already installed, else do nothing
Actual behavior:
Case 1
Error using plugin_askinstall (line 51)
Cannot find biosig extension, use EEGLAB Extension Manager to install it
Error in checkouteeglab (line 9)
plugin_askinstall(plugin, [], false);
Error in test (line 1)
checkouteeglab
Case 2
Warning: Error using plugin_askinstall (line 51)
Cannot find biosig extension, use EEGLAB Extension Manager to install it
Error in checkouteeglab (line 9)
plugin_askinstall(plugin, [], false);
Error in matlab.internal.project.util.runMATLABCodeInBase
Error in matlab.internal.project.util.runMATLABCodeInBase
Error in matlab.internal.project.util.runMATLABCodeInBase
Error in matlab.internal.project.util.runMATLABCodeInBase
Error in matlab.internal.project.util.runMATLABScriptDuringStartup
Error in matlab.project.loadProject
Error in matlab.project.loadProject
Error in matlab.internal.project.util.PathUtils.loadProjectForOpenPRJ
Error in openprj>i_openMATLABProject (line 88)
valid = matlab.internal.project.util.PathUtils.loadProjectForOpenPRJ(filename);
Error in openprj (line 37)
valid = i_openMATLABProject(filename);
Error in open (line 132)
feval(openAction,fullpath);
> In matlab.internal.project.util.runMATLABScriptDuringStartup
In matlab.project.loadProject
In matlab.project.loadProject
In matlab.internal.project.util/PathUtils/loadProjectForOpenPRJ
In openprj>i_openMATLABProject (line 88)
In openprj (line 37)
In open (line 132)
In uiopen (line 159)
Versions
OS version | Fedora 33 |
Matlab version | R2020b |
EEGLAB version | v2020_0 |
Suggestion
Remove the file name and stack trace length check.