本文整理了Java中com.liferay.gradle.util.FileUtil.relativize()
方法的一些代码示例,展示了FileUtil.relativize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.relativize()
方法的具体详情如下:
包路径:com.liferay.gradle.util.FileUtil
类名称:FileUtil
方法名:relativize
暂无
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-source-formatter
private String _merge(Iterable<File> files, File startFile) {
StringBuilder sb = new StringBuilder();
int i = 0;
for (File file : files) {
if (i > 0) {
sb.append(',');
}
sb.append(FileUtil.relativize(file, startFile));
i++;
}
return sb.toString();
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-source-formatter
private String _relativizeDir(File dir, File startDir) {
String relativePath = FileUtil.relativize(dir, startDir);
if (!relativePath.isEmpty()) {
if (File.separatorChar != '/') {
relativePath = relativePath.replace(File.separatorChar, '/');
}
if (relativePath.charAt(relativePath.length() - 1) != '/') {
relativePath += '/';
}
}
return relativePath;
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-jsdoc
private String _relativize(File file) {
String relativePath = FileUtil.relativize(file, getWorkingDir());
if (File.separatorChar != '/') {
relativePath = relativePath.replace(File.separatorChar, '/');
}
return relativePath;
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-change-log-builder
private static String _relativize(File file, Repository repository) {
File gitDir = repository.getDirectory();
String relativePath = FileUtil.relativize(file, gitDir.getParentFile());
if (File.separatorChar == '\\') {
relativePath = relativePath.replace('\\', '/');
}
return relativePath;
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-rest-builder
private String _relativize(File file) {
if (file == null) {
return null;
}
String relativePath = FileUtil.relativize(file, getWorkingDir());
return relativePath.replace('\\', '/');
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-app-javadoc-builder
private String _getPackageName(File file, Set<File> srcDirs) {
File dir = null;
for (File srcDir : srcDirs) {
if (FileUtil.isChild(file, srcDir)) {
dir = srcDir;
break;
}
}
if (dir == null) {
return null;
}
String relativePath = FileUtil.relativize(file, dir);
relativePath = relativePath.substring(
0, relativePath.lastIndexOf(File.separatorChar));
return relativePath.replace(File.separatorChar, '.');
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-tlddoc-builder
private List<String> _getCompleteArgs() {
List<String> args = new ArrayList<>(getArgs());
args.add("-d");
args.add(FileUtil.relativize(getDestinationDir(), getWorkingDir()));
File xsltDir = getXsltDir();
if (xsltDir != null) {
args.add("-xslt");
args.add(FileUtil.relativize(xsltDir, getWorkingDir()));
}
for (File file : getSource()) {
args.add(FileUtil.relativize(file, getWorkingDir()));
}
return args;
}
代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-lang-builder
private List<String> _getCompleteArgs() {
List<String> args = new ArrayList<>(getArgs());
args.add(
"lang.dir=" + FileUtil.relativize(getLangDir(), getWorkingDir()));
args.add(
"lang.excluded.language.ids=" +
StringUtil.merge(getExcludedLanguageIds(), ","));
args.add("lang.file=" + getLangFileName());
args.add("lang.title.capitalization=" + isTitleCapitalization());
boolean translate = isTranslate();
if (translate) {
String translateSubscriptionKey = getTranslateSubscriptionKey();
if (Validator.isNull(translateSubscriptionKey)) {
if (_logger.isWarnEnabled()) {
_logger.warn(
"Translation is disabled because credentials are not " +
"specified");
}
translate = false;
}
else {
args.add(
"lang.translate.subscription.key=" +
translateSubscriptionKey);
}
}
args.add("lang.translate=" + translate);
return args;
}
内容来源于网络,如有侵权,请联系作者删除!