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

%   Copyright 2012-2021 The MathWorks, Inc.

if isempty(h.ComponentBuildFolder) && ~isempty(getSourceFiles(h, 1, 1, 'BuildDir'))
    % TODO(g2434151) workaround because genSLCIBuildInfo does not yet use
    % coder.make.internal.loadBuildInfo
    buildDirSources = getSourceFiles(h, 1, 1, 'BuildDir');
    mainBuildFolder = fileparts(buildDirSources{1});
else
    mainBuildFolder = fullfile(h.Settings.LocalAnchorDir, h.ComponentBuildFolder);
end

ret = [mainBuildFolder ...
    fullfile(h.Settings.LocalAnchorDir, strrep({h.ModelRefs.Path}, '$(START_DIR)', ''))];
