function ret = getLibraryPaths(h, varargin)
% internal use only

%   Copyright 2017-2019 The MathWorks, Inc.

replaceTokens = false;
if nargin > 1
    replaceTokens = (varargin{1} == true);
end

% the CustomCode include paths are also library paths
ccPaths = h.getIncludePaths(true,'CustomCode');
if ~iscell(ccPaths)
    ccPaths = {ccPaths};
end

loPaths = get(h.LinkObj,'Path');

if ~iscell(loPaths)
    loPaths = {loPaths};
end

libPaths = [ccPaths loPaths{:}];

if replaceTokens
    libPaths = h.formatPaths(libPaths);
end

ret = RTW.unique(libPaths);

