time | Calls | line |
|---|
| | 1 | function helpDir = docroot(new_docroot)
|
| | 2 | %DOCROOT A utility to get or set the root directory of MATLAB Help
|
| | 3 | % DOCROOT returns the current docroot.
|
| | 4 | % DOCROOT(NEW_DOCROOT) sets the docroot to the new docroot, whether or
|
| | 5 | % not the new docroot is a valid directory. A warning is printed out if
|
| | 6 | % the directory appears to be invalid.
|
| | 7 | %
|
| | 8 | % The documentation root directory is set by default to be
|
| | 9 | % MATLABROOT/help. This value should not need to be changed, since
|
| | 10 | % documentation in other locations may not be compatible with the running
|
| | 11 | % version. However, if documentation from another location is desired,
|
| | 12 | % docroot can be changed by calling this function to set the value to
|
| | 13 | % another directory. This value is not saved in between sessions. To set
|
| | 14 | % this value every time MATLAB is run, a call to docroot can be inserted
|
| | 15 | % into startup.m.
|
| | 16 |
|
| | 17 | % Copyright 1984-2020 The MathWorks, Inc.
|
| | 18 |
|
| | 19 | % If at least one argument is passed in, set user docpath
|
< 0.001 | 1 | 20 | if nargin > 0
|
| | 21 | stringIn = isstring(new_docroot);
|
| | 22 | if stringIn
|
| | 23 | new_docroot = char(new_docroot);
|
| | 24 | end
|
| | 25 | if (usejava('jvm') == 1)
|
| | 26 | % remove trailing directory separator
|
| | 27 | if (~isempty(new_docroot) && new_docroot(end)==filesep)
|
| | 28 | new_docroot = new_docroot(1:end-1);
|
| | 29 | end
|
| | 30 | if ~com.mathworks.mlservices.MLHelpServices.setDocRoot(new_docroot)
|
| | 31 | % warn the user that docroot doesn't look like a valid docroot
|
| | 32 | warning(message('MATLAB:docroot:InvalidDirectoryNotSet'));
|
| | 33 | end
|
| | 34 | helpDir = new_docroot;
|
| | 35 | else
|
| | 36 | helpDir = fullfile(matlabroot, 'help');
|
| | 37 | disp(getString(message('MATLAB:docroot:ChangingDocrootNotSupported')));
|
| | 38 | end
|
| | 39 | if stringIn
|
| | 40 | helpDir = string(helpDir);
|
| | 41 | end
|
| | 42 |
|
| | 43 | matlab.internal.doc.updateConnectorDocroot(helpDir);
|
| | 44 | matlab.internal.reference.SetReferenceRoot(helpDir);
|
| | 45 | return;
|
< 0.001 | 1 | 46 | end
|
| | 47 |
|
| | 48 | % Get the docroot.
|
< 0.001 | 1 | 49 | if usejava('jvm')
|
0.001 | 1 | 50 | helpDir = strrep(char(com.mathworks.mlservices.MLHelpServices.getDocRoot), '/', filesep);
|
| | 51 | else
|
| | 52 | helpDir = fullfile(matlabroot,'help','');
|
< 0.001 | 1 | 53 | end
|
Other subfunctions in this file are not included in this listing.