提交 606a9e1d 编写于 作者: J Jesse Glick

File.setWritable should be the first, and if possible only, thing we try for makeWritable.

上级 4d8843c9
......@@ -252,6 +252,15 @@ public class Util {
*/
@IgnoreJRERequirement
private static void makeWritable(File f) {
// try JDK6-way of doing it.
try {
if (f.setWritable(true)) {
return;
}
} catch (NoSuchMethodError e) {
// not JDK6
}
// try chmod. this becomes no-op if this is not Unix.
try {
Chmod chmod = new Chmod();
......@@ -263,13 +272,6 @@ public class Util {
LOGGER.log(Level.INFO,"Failed to chmod "+f,e);
}
// also try JDK6-way of doing it.
try {
f.setWritable(true);
} catch (NoSuchMethodError e) {
// not JDK6
}
try {// try libc chmod
POSIX posix = PosixAPI.get();
String path = f.getAbsolutePath();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册