% RESTORE_PARENT_WRITABLE. Restore parent of file to read-only
% set_parent_writable(ParentAttributes,ParentReadOnly)
% Input:
%        ParentAttributes: struct defining file attributes of file parent
%        ParentReadOnly: logical array of file read-only attribute in
%                             Destination

%  JP Barnard
%  Copyright 1984-2004 The MathWorks, Inc.
%  $Revision: 1.3.4.2 $ $Date: 2004/07/16 18:33:57 $
%-------------------------------------------------------------------------------
function restore_parent_writable(ParentAttributes,ParentReadOnly)
%-------------------------------------------------------------------------------

% if read-only, change read-only to writable
if ParentReadOnly
   % set read-only to writable
   if isunix
      [tmp] = unix(['\chmod -w ', '"',ParentAttributes.Name,'"']);
   elseif ispc
      [tmp] = dos(['attrib +r ', '"',ParentAttributes.Name,'"']);
   end
end
%-------------------------------------------------------------------------------
return
% end of SET_PARENT_WRITABLE
%===============================================================================
