本文整理了Java中hudson.Util.chmod()
方法的一些代码示例,展示了Util.chmod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.chmod()
方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:chmod
[英]Run chmod natively if we can, otherwise fall back to Ant.
[中]如果可以的话,在本地运行chmod,否则就求助于Ant。
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public Void invoke(File f, VirtualChannel channel) throws IOException {
Util.chmod(f, mask);
return null;
}
});
代码示例来源:origin: org.eclipse.hudson/hudson-core
public static void chmod(File f, int mask) {
chmod(f, mask, true);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public Void invoke(File f, VirtualChannel channel) throws IOException {
Util.chmod(f, mask);
return null;
}
});
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public static void chmod(File f, int mask) {
chmod(f, mask, true);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f.getParentFile().mkdirs();
OutputStream os = new FileOutputStream(f);
try {
props.store(os, "Credential store");
} finally {
os.close();
}
// try to protect this file from other users, if we can.
Util.chmod(f, 0600, false, null);
return null;
}
});
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
f.getParentFile().mkdirs();
OutputStream os = new FileOutputStream(f);
try {
props.store(os,"Credential store");
} finally {
os.close();
}
// try to protect this file from other users, if we can.
Util.chmod(f, 0600, false);
return null;
}
});
代码示例来源:origin: org.eclipse.hudson/hudson-core
public static void chmod(File f, int mask, boolean tryNative) {
chmod(f, mask, tryNative, NativeUtils.getInstance());
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
private void process(File f) {
if (f.isFile()) {
if (Functions.isMustangOrAbove()) {
f.setExecutable(true, false);
} else {
Util.chmod(f, 0755);
}
} else {
File[] kids = f.listFiles();
if (kids != null) {
for (File kid : kids) {
process(kid);
}
}
}
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
private void process(File f) {
if (f.isFile()) {
if (Functions.isMustangOrAbove()) {
f.setExecutable(true, false);
} else {
Util.chmod(f, 0755);
}
} else {
File[] kids = f.listFiles();
if (kids != null) {
for (File kid : kids) {
process(kid);
}
}
}
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-plugin-utils
private void process(final File file) {
assert file != null;
if (file.isFile()) {
if (Functions.isMustangOrAbove()) {
if (!file.setExecutable(true, false)) {
log.error("Failed to chmod: {}", file);
}
}
else {
Util.chmod(file.getAbsoluteFile(), mode);
}
}
else {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
process(child);
}
}
}
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-plugin-utils
private void process(final File file) {
assert file != null;
if (file.isFile()) {
if (Functions.isMustangOrAbove()) {
if (!file.setExecutable(true, false)) {
log.error("Failed to chmod: {}", file);
}
}
else {
Util.chmod(file.getAbsoluteFile(), mode);
}
}
else {
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
process(child);
}
}
}
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-test-framework
/**
* Extracts Ant and configures it.
*/
protected Ant.AntInstallation configureDefaultAnt() throws Exception {
Ant.AntInstallation antInstallation;
if (System.getenv("ANT_HOME") != null) {
antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES);
} else {
LOGGER.warning("Extracting a copy of Ant bundled in the test harness. "
+ "To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation.");
FilePath ant = hudson.getRootPath().createTempFile("ant", "zip");
ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
File antHome = createTmpDir();
ant.unzip(new FilePath(antHome));
// TODO: switch to tar that preserves file permissions more easily
if (!Functions.isWindows()) {
Util.chmod(new File(antHome, "apache-ant-1.8.1/bin/ant"), 0755);
}
antInstallation = new AntInstallation("default", new File(antHome, "apache-ant-1.8.1").getAbsolutePath(), NO_PROPERTIES);
}
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Reads from a tar stream and stores obtained files to the base dir.
*/
private static void readFromTar(String name, File baseDir, InputStream in) throws IOException {
TarInputStream t = new TarInputStream(in);
try {
TarEntry te;
while ((te = t.getNextEntry()) != null) {
File f = new File(baseDir,te.getName());
if(te.isDirectory()) {
f.mkdirs();
} else {
File parent = f.getParentFile();
if (parent != null) parent.mkdirs();
IOUtils.copy(t,f);
f.setLastModified(te.getModTime().getTime());
int mode = te.getMode()&0777;
if(mode!=0 && !Functions.isWindows()) // be defensive
Util.chmod(f, mode);
}
}
} catch(IOException e) {
throw new IOException2("Failed to extract "+name,e);
} finally {
t.close();
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-test-framework
Util.chmod(new File(mvnHome, mavenVersion + "/bin/mvn"), 0755);
代码示例来源:origin: org.eclipse.hudson/hudson-core
Util.chmod(f, mode, true, nativeUtils);
内容来源于网络,如有侵权,请联系作者删除!