本文整理汇总了Java中com.intellij.openapi.util.io.FileUtilRt.toSystemIndependentName方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtilRt.toSystemIndependentName方法的具体用法?Java FileUtilRt.toSystemIndependentName怎么用?Java FileUtilRt.toSystemIndependentName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtilRt
的用法示例。
在下文中一共展示了FileUtilRt.toSystemIndependentName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toURI
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public static URI toURI(String localPath) {
try {
String p = FileUtilRt.toSystemIndependentName(localPath);
if (!p.startsWith("/")) {
p = "/" + p;
}
if (!p.startsWith("//")) {
p = "//" + p;
}
return new URI("file", null, p, null);
}
catch (URISyntaxException e) {
throw new Error(e);
}
}
示例2: convertToRegexp
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private static CompiledPattern convertToRegexp(String wildcardPattern) {
if (isPatternNegated(wildcardPattern)) {
wildcardPattern = wildcardPattern.substring(1);
}
wildcardPattern = FileUtilRt.toSystemIndependentName(wildcardPattern);
String srcRoot = null;
int colon = wildcardPattern.indexOf(":");
if (colon > 0) {
srcRoot = wildcardPattern.substring(0, colon);
wildcardPattern = wildcardPattern.substring(colon + 1);
}
String dirPattern = null;
int slash = wildcardPattern.lastIndexOf('/');
if (slash >= 0) {
dirPattern = wildcardPattern.substring(0, slash + 1);
wildcardPattern = wildcardPattern.substring(slash + 1);
if (!dirPattern.startsWith("/")) {
dirPattern = "/" + dirPattern;
}
//now dirPattern starts and ends with '/'
dirPattern = normalizeWildcards(dirPattern);
dirPattern = StringUtil.replace(dirPattern, "/.*.*/", "(/.*)?/");
dirPattern = StringUtil.trimEnd(dirPattern, "/");
dirPattern = optimize(dirPattern);
}
wildcardPattern = normalizeWildcards(wildcardPattern);
wildcardPattern = optimize(wildcardPattern);
final Pattern dirCompiled = dirPattern == null ? null : compilePattern(dirPattern);
final Pattern srcCompiled = srcRoot == null ? null : compilePattern(optimize(normalizeWildcards(srcRoot)));
return new CompiledPattern(compilePattern(wildcardPattern), dirCompiled, srcCompiled);
}
示例3: getLibraryRootUrl
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
public static String getLibraryRootUrl(File file) {
String path = FileUtilRt.toSystemIndependentName(file.getAbsolutePath());
if (file.isDirectory()) {
return "file://" + path;
}
return "jar://" + path + "!/";
}
示例4: loadProjectByAbsolutePath
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
protected void loadProjectByAbsolutePath(String path) {
myProjectHomePath = FileUtilRt.toSystemIndependentName(path);
if (myProjectHomePath.endsWith(".ipr")) {
myProjectHomePath = PathUtil.getParentPath(myProjectHomePath);
}
try {
JpsProjectLoader.loadProject(myProject, getPathVariables(), path);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
示例5: createProject
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
private ProjectImpl createProject(@Nullable String projectName, @NotNull String filePath, boolean isDefault) {
if (isDefault) {
return new DefaultProject(this, "");
}
else {
return new ProjectImpl(this, FileUtilRt.toSystemIndependentName(filePath), projectName);
}
}
示例6: compare
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public int compare(@NotNull FilePath filePath1, @NotNull FilePath filePath2) {
final String path1 = FileUtilRt.toSystemIndependentName(filePath1.getPath());
final String path2 = FileUtilRt.toSystemIndependentName(filePath2.getPath());
int index1 = 0;
int index2 = 0;
int start = 0;
while (index1 < path1.length() && index2 < path2.length()) {
char c1 = path1.charAt(index1);
char c2 = path2.charAt(index2);
if (StringUtil.compare(c1, c2, myIgnoreCase) != 0) break;
if (c1 == '/') start = index1;
index1++;
index2++;
}
if (index1 == path1.length() && index2 == path2.length()) return 0;
if (index1 == path1.length()) return -1;
if (index2 == path2.length()) return 1;
int end1 = path1.indexOf('/', start + 1);
int end2 = path2.indexOf('/', start + 1);
String name1 = end1 == -1 ? path1.substring(start) : path1.substring(start, end1);
String name2 = end2 == -1 ? path2.substring(start) : path2.substring(start, end2);
boolean isDirectory1 = end1 != -1 || filePath1.isDirectory();
boolean isDirectory2 = end2 != -1 || filePath2.isDirectory();
if (isDirectory1 && !isDirectory2) return -1;
if (!isDirectory1 && isDirectory2) return 1;
return StringUtil.compare(name1, name2, myIgnoreCase);
}
示例7: getRootId
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Override
public String getRootId() {
return FileUtilRt.toSystemIndependentName(myRoot.getAbsolutePath());
}
示例8: toSystemIndependentName
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@Contract("null -> null; !null -> !null")
public static String toSystemIndependentName(@Nullable String path) {
return path == null ? null : FileUtilRt.toSystemIndependentName(path);
}
示例9: newLocalFileUrl
import com.intellij.openapi.util.io.FileUtilRt; //导入方法依赖的package包/类
@NotNull
public static Url newLocalFileUrl(@NotNull String path) {
return new LocalFileUrl(FileUtilRt.toSystemIndependentName(path));
}