本文整理汇总了Java中com.intellij.openapi.util.io.FileUtil.toSystemDependentName方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.toSystemDependentName方法的具体用法?Java FileUtil.toSystemDependentName怎么用?Java FileUtil.toSystemDependentName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.io.FileUtil
的用法示例。
在下文中一共展示了FileUtil.toSystemDependentName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkDependencyMerge
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void checkDependencyMerge(String destPath, String srcPath, String goldenPath) {
File destFile = new File(getTestDataPath(), FileUtil.toSystemDependentName(destPath));
String dest = TemplateUtils.readTextFile(destFile);
assertNotNull(dest);
File srcFile = new File(getTestDataPath(), FileUtil.toSystemDependentName(srcPath));
String source = TemplateUtils.readTextFile(srcFile);
assertNotNull(source);
File goldenFile = new File(getTestDataPath(), FileUtil.toSystemDependentName(goldenPath));
String golden = TemplateUtils.readTextFile(goldenFile);
assertNotNull(golden);
// Strip comments from merged file
assertEquals(golden.replaceAll("\\s+","\n"),
GradleFileMerger.mergeGradleFiles(source, dest, getProject()).replaceAll("\\s+//.*", "").replaceAll("\\s+", "\n"));
}
示例2: testFindUsages
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public void testFindUsages() {
initProject("findManager", "src", "src1");
String projectDir = FileUtil.toSystemDependentName(PathManagerEx.getTestDataPath() + "/find/findManager");
FindModel findModel = new FindModel();
findModel.setStringToFind("done");
findModel.setWholeWordsOnly(false);
findModel.setFromCursor(false);
findModel.setGlobal(true);
findModel.setMultipleFiles(true);
findModel.setProjectScope(true);
findModel.setDirectoryName(projectDir + File.separatorChar + "src1");
findModel.setWithSubdirectories(true);
checkFindUsages(12, findModel);
findModel.setFromCursor(false);
findModel.setGlobal(true);
findModel.setMultipleFiles(true);
findModel.setProjectScope(false);
findModel.setDirectoryName(projectDir + File.separatorChar + "src1");
findModel.setWithSubdirectories(true);
checkFindUsages(6, findModel);
findModel.setWholeWordsOnly(true);
checkFindUsages(5, findModel);
}
示例3: getTestSpecs
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected List<String> getTestSpecs() {
List<String> specs = new ArrayList<String>();
final String scriptName = FileUtil.toSystemDependentName(myConfig.getScriptName());
switch (myConfig.getTestType()) {
case TEST_SCRIPT:
specs.add(scriptName);
break;
case TEST_CLASS:
specs.add(scriptName + "::" + myConfig.getClassName());
break;
case TEST_METHOD:
specs.add(scriptName + "::" + myConfig.getClassName() + "::" + myConfig.getMethodName());
break;
case TEST_FOLDER:
specs.add(FileUtil.toSystemDependentName(myConfig.getFolderName() + "/"));
break;
case TEST_FUNCTION:
specs.add(scriptName + "::::" + myConfig.getMethodName());
break;
default:
throw new IllegalArgumentException("Unknown test type: " + myConfig.getTestType());
}
return specs;
}
示例4: getTestPath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
private static String getTestPath(@NotNull ConfigurationContext context) {
Location location = context.getLocation();
if (location == null) {
return null;
}
VirtualFile file = location.getVirtualFile();
if (file == null) {
return null;
}
VirtualFile taskDir = StudyUtils.getTaskDir(file);
if (taskDir == null) {
return null;
}
Task task = StudyUtils.getTask(location.getProject(), taskDir);
if (task == null) {
return null;
}
String testsFileName = PyEduPluginConfigurator.getSubtaskTestsFileName(task instanceof TaskWithSubtasks ?
((TaskWithSubtasks)task).getActiveSubtaskIndex() : 0);
String taskDirPath = FileUtil.toSystemDependentName(taskDir.getPath());
String testsPath = taskDir.findChild(EduNames.SRC) != null ?
FileUtil.join(taskDirPath, EduNames.SRC, testsFileName) :
FileUtil.join(taskDirPath, testsFileName);
String filePath = FileUtil.toSystemDependentName(file.getPath());
return filePath.equals(testsPath) ? testsPath : null;
}
示例5: getProjectPath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
@Nullable
protected String getProjectPath(@NotNull Project project) {
final ProjectBaseDirectory baseDir = ProjectBaseDirectory.getInstance(project);
final VirtualFile baseDirVFile = baseDir.getBaseDir() != null ? baseDir.getBaseDir() : project.getBaseDir();
return baseDirVFile != null ? FileUtil.toSystemDependentName(baseDirVFile.getPath()) : null;
}
示例6: findFindUnderProjectHome
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
protected File findFindUnderProjectHome(String relativePath) {
final String homePath = getAndroidHomePath();
final File file = new File(homePath, FileUtil.toSystemDependentName(relativePath));
if (!file.exists()) {
throw new IllegalArgumentException("Cannot find file '" + relativePath + "' under '" + homePath + "' directory");
}
return file;
}
示例7: AdtImportLocationStep
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public AdtImportLocationStep(WizardContext context) {
super(context);
myDestinationLabel.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
String prev = context.getProjectFileDirectory();
mySourceProject = new File(FileUtil.toSystemDependentName(prev));
String name = new File(prev).getName();
//noinspection ConstantConditions
context.setProjectFileDirectory(null);
String defaultDir = context.getProjectFileDirectory();
int index = 0;
File file;
do {
String suffix = index == 0 ? "" : Integer.toString(index);
index++;
file = new File(defaultDir, name + suffix);
} while (file.exists());
myDestDirText.setText(file.getPath());
context.setProjectFileDirectory(prev);
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
descriptor.setTitle("Choose Destination Directory");
descriptor.setDescription("Pick a directory to import the given Eclipse Android project into");
myDestDirText.addBrowseFolderListener(new TextBrowseFolderListener(descriptor) {
@Override
protected void onFileChosen(@NotNull VirtualFile chosenFile) {
super.onFileChosen(chosenFile);
myIsPathChangedByUser = true;
}
@Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
myIsPathChangedByUser = true;
}
});
}
示例8: updateOutputPath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private void updateOutputPath(@NotNull Key<String> relativeDirKey, @NotNull Key<String> outputDirKey) {
String projectLocation = myState.get(PROJECT_LOCATION_KEY);
String moduleName = myState.get(myModuleNameKey);
String relativeLocation = myState.get(relativeDirKey);
if (relativeLocation == null || projectLocation == null || moduleName == null) {
return;
}
File baseLocation = new File(projectLocation, moduleName);
relativeLocation = FileUtil.toSystemDependentName(relativeLocation);
myState.put(outputDirKey, new File(baseLocation, relativeLocation).getPath());
}
示例9: getContainingFileName
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@NotNull
private static String getContainingFileName(@NotNull PsiElement element) {
final VirtualFile file = element.getContainingFile().getVirtualFile();
if (file != null) {
return FileUtil.toSystemDependentName(file.getPath());
}
else {
return "";
}
}
示例10: getApkPath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Nullable
public static String getApkPath(@NotNull JpsAndroidModuleExtension extension, @NotNull File outputDirForPackagedArtifacts) {
final String apkRelativePath = extension.getApkRelativePath();
final JpsModule module = extension.getModule();
if (apkRelativePath == null || apkRelativePath.length() == 0) {
return new File(outputDirForPackagedArtifacts, getApkName(module)).getPath();
}
File moduleBaseDirectory = JpsModelSerializationDataService.getBaseDirectory(module);
return moduleBaseDirectory != null ? FileUtil.toSystemDependentName(moduleBaseDirectory.getAbsolutePath() + apkRelativePath) : null;
}
示例11: moveToMergedGroup
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
protected void moveToMergedGroup(final List<VirtualFile> merged) {
final FileGroup conflictedGroup = myUpdatedFiles.getGroupById(groupId);
FileGroup mergedGroup = myUpdatedFiles.getGroupById(FileGroup.MERGED_ID);
for (VirtualFile mergedFile: merged) {
final String path = FileUtil.toSystemDependentName(mergedFile.getPresentableUrl());
final VcsRevisionNumber revision = conflictedGroup.getRevision(myVcsManager, path);
conflictedGroup.remove(path);
mergedGroup.add(path, myVcs.getKeyInstanceMethod(), revision);
}
}
示例12: setUp
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
if (shouldContainTempFiles()) {
String testName = FileUtil.sanitizeFileName(getTestName(true));
if (StringUtil.isEmptyOrSpaces(testName)) testName = "";
testName = new File(testName).getName(); // in case the test name contains file separators
myTempDir = FileUtil.toSystemDependentName(ORIGINAL_TEMP_DIR + "/" + TEMP_DIR_MARKER + testName + "_"+ RNG.nextInt(1000));
FileUtil.resetCanonicalTempPathCache(myTempDir);
}
ApplicationInfoImpl.setInPerformanceTest(isPerformanceTest());
}
示例13: getTaskFilePath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
private String getTaskFilePath(String name) {
String taskDirPath = FileUtil.toSystemDependentName(myTaskDir.getPath());
return myTaskDir.findChild(EduNames.SRC) != null ?
FileUtil.join(taskDirPath, EduNames.SRC, name) :
FileUtil.join(taskDirPath, name);
}
示例14: getLocationPath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
public String getLocationPath() {
return FileUtil.toSystemDependentName(myLocationField.getText());
}
示例15: getOrmLibPath
import com.intellij.openapi.util.io.FileUtil; //导入方法依赖的package包/类
@Override
public String getOrmLibPath() {
return FileUtil.toSystemDependentName(JpsArtifactPathUtil.appendToPath(getSdkHomePath(), "/lib/user/orm"));
}