SET_PERMISSIONS set path permissions

Contents

Inputs

Outputs

native backend is much more robust, if available

function [ok, b] = set_permissions(file, readable, writable, executable)

try
  ok = stdlib.native.set_permissions(file, readable, writable, executable);
  b = 'native';
catch e
  switch e.identifier
    case {'MATLAB:UndefinedFunction', 'MATLAB:m_illegal_character'}
      ok = stdlib.legacy.set_permissions(file, readable, writable, executable);
      b = 'legacy';
    case 'MATLAB:io:filesystem:filePermissions:CannotFindLocation'
      ok = false;
      b = '';
    otherwise
      rethrow(e)
  end
end

end