本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.setExecutableAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.setExecutableAttribute方法的具体用法?Java FileUtil.setExecutableAttribute怎么用?Java FileUtil.setExecutableAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.setExecutableAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setGradleWrapperExecutable
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
* Set the executable bit on the 'gradlew' wrapper script on Mac/Linux
* On Windows, we use a separate gradlew.bat file which does not need an
* executable bit.
* @throws IOException
*/
public static void setGradleWrapperExecutable(File projectRoot) throws IOException {
if (SystemInfo.isUnix) {
File gradlewFile = new File(projectRoot, "gradlew");
if (!gradlewFile.isFile()) {
LOG.error("Could not find gradle wrapper. Command line builds may not work properly.");
}
else {
FileUtil.setExecutableAttribute(gradlewFile.getPath(), true);
}
}
}
示例2: generate
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
/**
* Generate script according to specified parameters
*
* @return the path to generated script
* @throws IOException if there is a problem with creating script
*/
@SuppressWarnings({"HardCodedStringLiteral"})
public File generate() throws IOException {
File scriptPath = FileUtil.createTempFile(myPrefix, SCRIPT_EXT);
scriptPath.deleteOnExit();
PrintWriter out = new PrintWriter(new FileWriter(scriptPath));
try {
if (SystemInfo.isWindows) {
out.println("@echo off");
}
else {
out.println("#!/bin/sh");
}
String line = commandLine();
if (SystemInfo.isWindows) {
line += " %*";
}
else {
line += " \"[email protected]\"";
}
out.println(line);
}
finally {
out.close();
}
FileUtil.setExecutableAttribute(scriptPath.getPath(), true);
return scriptPath;
}