function addAttachedFiles(aPool, files)
%

%   Copyright 2013-2020 The MathWorks, Inc.

% Convert any string inputs to character vectors
files = convertStringsToChars(files);

validateattributes(aPool, {'parallel.Pool'}, {'nonempty', 'scalar'}, mfilename, 'pool', 1);
validateattributes(files, {'cell','char'}, {}, mfilename, 'files', 2);
errorIfPoolNotUsable(aPool);
    
if ischar(files)
    files = {files};
elseif ~iscellstr(files)
    error(message('MATLAB:parallel:pool:InvalidAttachFilesArgument'));
end

successfullyAttachedFiles = aPool.FileManager.addAttachedFiles(files);
anyFileHasBeenIgnored = numel(files) ~= numel(successfullyAttachedFiles);
if anyFileHasBeenIgnored
    parallel.internal.warningNoBackTrace(message('parallel:lang:pool:IgnoringAlreadyAttachedFiles'));
end

end
