1 19 package org.netbeans.lib.cvsclient.file; 20 21 import java.io.*; 22 23 import org.netbeans.lib.cvsclient.util.*; 24 25 29 public class WindowsFileReadOnlyHandler 30 implements FileReadOnlyHandler { 31 33 38 public void setFileReadOnly(File file, boolean readOnly) throws IOException { 39 if (file == null) { 40 throw new IllegalArgumentException ("file must not be null"); } 42 43 try { 44 String [] arguments = { 45 "attrib", readOnly ? "+r": "-r", file.getName() 48 }; 49 Process process = Runtime.getRuntime().exec(arguments, null, file.getParentFile()); 50 process.waitFor(); 51 } 52 catch (InterruptedException ex) { 53 BugLog.getInstance().showException(ex); 54 } 55 } 56 } 57 | Popular Tags |