time | Calls | line |
|---|
| | 1 | function s = toolboxdir(tbxdirname)
|
| | 2 | % TOOLBOXDIR Root folder for specified toolbox
|
| | 3 | % S = TOOLBOXDIR(TBXDIRNAME) returns a character vector that is the
|
| | 4 | % absolute path to the specified toolbox folder name, TBXDIRNAME
|
| | 5 | %
|
| | 6 | % TOOLBOXDIR is particularly useful for MATLAB Compiler. The base
|
| | 7 | % folder of all toolboxes installed with MATLAB is
|
| | 8 | % <matlabroot>/toolbox/<tbxdirname>. However, in deployed mode, the base
|
| | 9 | % folders of the toolboxes are different. TOOLBOXDIR returns the
|
| | 10 | % correct root folder irrespective of the mode in which the code is
|
| | 11 | % running. Note that TOOLBOXDIR lowercases any input path that matches
|
| | 12 | % a path in the MCR modulo case. It preserves the case of input paths
|
| | 13 | % that do not - i.e. those that lie in the CTF.
|
| | 14 | %
|
| | 15 | % See also MATLABROOT, COMPILER/CTFROOT.
|
| | 16 |
|
| | 17 | % Copyright 1984-2020 The MathWorks, Inc.
|
| | 18 |
|
< 0.001 | 4 | 19 | narginchk(1,1)
|
< 0.001 | 4 | 20 | validateattributes(tbxdirname,{'char','string'},{'scalartext'}, ...
|
| | 21 | 'toolboxdir','',1)
|
< 0.001 | 4 | 22 | tbxdirname = char(tbxdirname);
|
| | 23 |
|
< 0.001 | 4 | 24 | if isdeployed
|
| | 25 | % In deployed mode, lower cases tbx name if it is in MCR.
|
| | 26 | % Check if the tbx directory exists in MCR first.
|
| | 27 | s = fullfile(tbxprefix, lower(tbxdirname));
|
| | 28 | if isfolder(s)
|
| | 29 | return
|
| | 30 | end
|
| | 31 |
|
| | 32 | % In deployed mode, don't lower case tbx name if it is in CTF.
|
| | 33 | s = fullfile(ctfroot, 'toolbox', tbxdirname);
|
| | 34 | if isfolder(s)
|
| | 35 | return
|
| | 36 | end
|
< 0.001 | 4 | 37 | else
|
| | 38 | % In desktop mode, case is not changed.
|
< 0.001 | 4 | 39 | s = fullfile(tbxprefix, tbxdirname);
|
< 0.001 | 4 | 40 | if isfolder(s)
|
< 0.001 | 4 | 41 | return
|
| | 42 | end
|
| | 43 | end
|
| | 44 |
|
| | 45 | % The tbx directory does not exist, if it reaches here. Check if it has
|
| | 46 | % been renamed or is just unknown.
|
| | 47 | newname = checkRenamedToolboxFolders(tbxdirname);
|
| | 48 | if ~isequal(newname, tbxdirname)
|
| | 49 | warning(message('MATLAB:toolboxdir:ProductNameDeprecated', tbxdirname, newname));
|
| | 50 | s = toolboxdir(newname);
|
| | 51 | return;
|
| | 52 | end
|
| | 53 |
|
| | 54 | error(message('MATLAB:toolboxdir:DirectoryNotFound', tbxdirname))
|
Other subfunctions in this file are not included in this listing.