function b = folderHasContents(folder, checkEmptyContents)
%

%   Copyright 2018-2020 The MathWorks, Inc.

    if any(ismember(folder.m, 'Contents.m'))
        if checkEmptyContents
            dirHelpStr = matlab.internal.language.introspective.callHelpFunction(@help.mFile, fullfile(folder.path, 'Contents.m'), true);
            b = ~isempty(dirHelpStr);
        else
            b = true;
        end
    else
        b = any(~structfun(@isempty, rmfield(folder, 'path')));
    end
end
