本文整理匯總了Java中com.intellij.openapi.util.io.FileUtil.toSystemIndependentName方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.toSystemIndependentName方法的具體用法?Java FileUtil.toSystemIndependentName怎麽用?Java FileUtil.toSystemIndependentName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.toSystemIndependentName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTemplateRootFolder
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
/**
* @return the root folder containing templates
*/
@Nullable
public static File getTemplateRootFolder() {
String homePath = FileUtil.toSystemIndependentName(PathManager.getHomePath());
// Release build?
VirtualFile root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(homePath + BUNDLED_TEMPLATE_PATH));
if (root == null) {
// Development build?
for (String path : DEVELOPMENT_TEMPLATE_PATHS) {
root = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(homePath + path));
if (root != null) {
break;
}
}
}
if (root != null) {
File rootFile = VfsUtilCore.virtualToIoFile(root);
if (templateRootIsValid(rootFile)) {
return rootFile;
}
}
// Fall back to SDK template root
AndroidSdkData sdkData = AndroidSdkUtils.tryToChooseAndroidSdk();
if (sdkData != null) {
File location = sdkData.getLocation();
File folder = new File(location, FD_TOOLS + File.separator + FD_TEMPLATES);
if (folder.isDirectory()) {
return folder;
}
}
return null;
}
示例2: getText
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
public String getText() {
final AntDomFileReferenceSet refSet = getFileReferenceSet();
final String _path = AntStringResolver.computeString(refSet.getAttributeValue(), super.getText());
final String text = FileUtil.toSystemIndependentName(_path);
return text.endsWith("/")? text.substring(0, text.length() - "/".length()) : text;
}
示例3: getConfiguredOutputPath
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
private String getConfiguredOutputPath() {
String outputPath = FileUtil.toSystemIndependentName(myOutputDirectoryField.getText().trim());
if (outputPath.length() == 0) {
outputPath = null;
}
return outputPath;
}
示例4: addFileOrDirRecursively
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private void addFileOrDirRecursively(@NotNull ZipOutputStream jarOutputStream,
@NotNull File file,
SourceFileFilter filter,
@NotNull String relativePath,
String targetJarPath,
@NotNull Set<String> writtenItemRelativePaths,
List<String> packedFilePaths,
int rootIndex) throws IOException {
final String filePath = FileUtil.toSystemIndependentName(file.getAbsolutePath());
if (!filter.accept(filePath) || !filter.shouldBeCopied(filePath, myContext.getProjectDescriptor())) {
return;
}
if (file.isDirectory()) {
final String directoryPath = relativePath.length() == 0 ? "" : relativePath + "/";
if (!directoryPath.isEmpty()) {
addDirectoryEntry(jarOutputStream, directoryPath, writtenItemRelativePaths);
}
final File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
addFileOrDirRecursively(jarOutputStream, child, filter, directoryPath + child.getName(), targetJarPath, writtenItemRelativePaths,
packedFilePaths, rootIndex);
}
}
return;
}
final boolean added = ZipUtil.addFileToZip(jarOutputStream, file, relativePath, writtenItemRelativePaths, null);
if (rootIndex != -1) {
myOutSrcMapping.appendData(targetJarPath, rootIndex, filePath);
if (added) {
packedFilePaths.add(filePath);
}
}
}
示例5: calcConfigPath
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Nullable
private static String calcConfigPath(@NotNull String path) {
try {
final String _path = FileUtil.toSystemIndependentName(new File(path).getCanonicalPath());
return _path.endsWith("/") ? _path : _path + "/";
}
catch (IOException e) {
LOG.info(e);
return null;
}
}
示例6: preparePathsForComparison
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static String preparePathsForComparison(String fileContent, Module mod1, Module mod2) {
fileContent = FileUtil.toSystemIndependentName(fileContent);
fileContent = replace(fileContent, ModuleRootManager.getInstance(mod1).getContentRoots()[0].getPath(), "MODULE_1");
fileContent = replace(fileContent, ModuleRootManager.getInstance(mod2).getContentRoots()[0].getPath(), "MODULE_2");
fileContent = replace(fileContent, PathUtil.getJarPathForClass(ServiceMessageTypes.class), "SERVICE_MESSAGES");
fileContent = fileContent.replaceAll(FileUtil.toSystemIndependentName(PathUtil.getJarPathForClass(JUnitStarter.class)) + File.pathSeparator, "");
fileContent = fileContent.replaceAll(FileUtil.toSystemIndependentName(JavaSdkUtil.getIdeaRtJarPath()) + File.pathSeparator, "");
fileContent = replace(fileContent, PathManager.getHomePath() + "/community", "IDEA_HOME");
fileContent = replace(fileContent, PathManager.getHomePath(), "IDEA_HOME");
fileContent = fileContent.replaceAll(File.pathSeparator, ";");
return StringUtil.convertLineSeparators(fileContent);
}
示例7: resolve
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public PsiElement resolve() {
VirtualFile baseDir = myPsiFile.getVirtualFile().getParent();
String relPath = FileUtil.toSystemIndependentName(myText + "/" + MavenConstants.POM_XML);
VirtualFile file = baseDir.findFileByRelativePath(relPath);
if (file == null) return null;
return getPsiFile(file);
}
示例8: getTestDataFolder
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public static String getTestDataFolder() {
final File f = new File("src/test/resources");
return FileUtil.toSystemIndependentName(f.getAbsolutePath());
}
示例9: getScriptName
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
public String getScriptName() {
return FileUtil.toSystemIndependentName(myScriptTextField.getText().trim());
}
示例10: getRepositoryPath
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
protected String getRepositoryPath() {
String path = getRepositoryFile().getPath();
return FileUtil.toSystemIndependentName(path);
}
示例11: setupRootModel
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static void setupRootModel(
ProjectDescriptor projectDescriptor,
final ModuleDescriptor descriptor,
final ModifiableRootModel rootModel,
final Map<LibraryDescriptor, Library> projectLibs) {
final CompilerModuleExtension compilerModuleExtension =
rootModel.getModuleExtension(CompilerModuleExtension.class);
compilerModuleExtension.setExcludeOutput(true);
rootModel.inheritSdk();
//Module root model seems to store .iml files root dependencies. (src, test, lib)
logger.info("Starting setupRootModel in ProjectFromSourcesBuilderImplModified");
final Set<File> contentRoots = descriptor.getContentRoots();
for (File contentRoot : contentRoots) {
final LocalFileSystem lfs = LocalFileSystem.getInstance();
VirtualFile moduleContentRoot =
lfs.refreshAndFindFileByPath(
FileUtil.toSystemIndependentName(contentRoot.getPath()));
if (moduleContentRoot != null) {
final ContentEntry contentEntry = rootModel.addContentEntry(moduleContentRoot);
final Collection<DetectedSourceRoot> sourceRoots =
descriptor.getSourceRoots(contentRoot);
for (DetectedSourceRoot srcRoot : sourceRoots) {
final String srcpath =
FileUtil.toSystemIndependentName(srcRoot.getDirectory().getPath());
final VirtualFile sourceRoot = lfs.refreshAndFindFileByPath(srcpath);
if (sourceRoot != null) {
contentEntry.addSourceFolder(
sourceRoot,
shouldBeTestRoot(srcRoot.getDirectory()),
getPackagePrefix(srcRoot));
}
}
}
}
logger.info("Inherits compiler output path from project");
compilerModuleExtension.inheritCompilerOutputPath(true);
logger.info("Starting to create module level libraries");
final LibraryTable moduleLibraryTable = rootModel.getModuleLibraryTable();
for (LibraryDescriptor libDescriptor :
ModuleInsight.getLibraryDependencies(
descriptor, projectDescriptor.getLibraries())) {
final Library projectLib = projectLibs.get(libDescriptor);
if (projectLib != null) {
rootModel.addLibraryEntry(projectLib);
} else {
// add as module library
final Collection<File> jars = libDescriptor.getJars();
for (File file : jars) {
Library library = moduleLibraryTable.createLibrary();
Library.ModifiableModel modifiableModel = library.getModifiableModel();
modifiableModel.addRoot(
VfsUtil.getUrlForLibraryRoot(file), OrderRootType.CLASSES);
modifiableModel.commit();
}
}
}
logger.info("Ending setupRootModel in ProjectFromSourcesBuilderImplModified");
}
示例12: doEvaluate
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private String doEvaluate(final String text, final String file) {
final PyExpression expression = PyElementGenerator.getInstance(myFixture.getProject()).createExpressionFromText(text);
return FileUtil.toSystemIndependentName((String) new PyPathEvaluator(file).evaluate(expression));
}
示例13: getRootPath
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
@Override
@NotNull
public String getRootPath() {
return FileUtil.toSystemIndependentName(myFSRootPath);
}
示例14: getPath
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
public String getPath() {
return FileUtil.toSystemIndependentName(myPathField.getChildComponent().getText().trim());
}
示例15: getArtifactBaseOutputPath
import com.intellij.openapi.util.io.FileUtil; //導入方法依賴的package包/類
private static String getArtifactBaseOutputPath(Project project) {
String outputUrl = project.getBaseDir().getUrl() + "/out/artifacts";
return FileUtil.toSystemIndependentName(VfsUtilCore.urlToPath(outputUrl));
}