mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-10 10:36:21 +00:00
File.setWritable should be the first, and if possible only, thing we try for makeWritable.
This commit is contained in:
1 parent
4d8843c991
commit
606a9e1de9
1 file changed
+9
-7
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user