function mustBeFolder(path)
%MATLAB Code Generation Library Function

%   Copyright 2022 The MathWorks, Inc.
%#codegen


if coder.internal.canUseExtrinsic()
    % Run the check in MATLAB to issue a run-time error with
    % MATLAB's full error message.
    feval('mustBeFolder',path);
else
    if ~coder.internal.hasRuntimeErrors()
        return;
    end
    % Issue a simplified run-time error (no listing of folder that aren't found).
    coder.internal.assert(isNontrivialText(path), 'MATLAB:validators:nonzeroLengthText');
    tf = isfolder(path);
    if iscell(path)
        % Cell array
        numFiles = coder.internal.indexInt(numel(path));
        for i = 1:numFiles
            coder.internal.assert(tf(i), 'Coder:toolbox:mustBeFolder');
        end
    else
        % String or char vector
        coder.internal.assert(tf, 'Coder:toolbox:mustBeFolder');
    end
end