当前位置: 首页>>代码示例>>Java>>正文


Java SystemInfo.isFileSystemCaseSensitive方法代码示例

本文整理汇总了Java中com.intellij.openapi.util.SystemInfo.isFileSystemCaseSensitive方法的典型用法代码示例。如果您正苦于以下问题:Java SystemInfo.isFileSystemCaseSensitive方法的具体用法?Java SystemInfo.isFileSystemCaseSensitive怎么用?Java SystemInfo.isFileSystemCaseSensitive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.util.SystemInfo的用法示例。


在下文中一共展示了SystemInfo.isFileSystemCaseSensitive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectModifiedClasses

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static boolean collectModifiedClasses(File file, String filePath, String rootPath, Map<String, HotSwapFile> container, HotSwapProgress progress, long timeStamp) {
  if (progress.isCancelled()) {
    return false;
  }
  final File[] files = file.listFiles();
  if (files != null) {
    for (File child : files) {
      if (!collectModifiedClasses(child, filePath + "/" + child.getName(), rootPath, container, progress, timeStamp)) {
        return false;
      }
    }
  }
  else { // not a dir
    if (SystemInfo.isFileSystemCaseSensitive? StringUtil.endsWith(filePath, CLASS_EXTENSION) : StringUtil.endsWithIgnoreCase(filePath, CLASS_EXTENSION)) {
      if (file.lastModified() > timeStamp) {
        progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath));
        //noinspection HardCodedStringLiteral
        final String qualifiedName = filePath.substring(rootPath.length(), filePath.length() - CLASS_EXTENSION.length()).replace('/', '.');
        container.put(qualifiedName, new HotSwapFile(file));
      }
    }
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:HotSwapManager.java

示例2: testLongRepeatedPattern

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Test
public void testLongRepeatedPattern() throws Exception {
  final String dirName = SystemInfo.isFileSystemCaseSensitive ? "somedir/long/path" : "somEdir/lonG/path";
  final File file = new File(myProjectFixture.getProject().getBaseDir().getPath(), "somedir");
  FileUtil.delete(file);
  Assert.assertTrue(file.mkdir(), "can't create: " + file.getAbsolutePath());
  final File childDir = new File(file, "long/path/and/a/path/path/path/to/long/path");
  Assert.assertTrue(childDir.mkdirs(), "can't create: " + childDir.getAbsolutePath());
  final File a = new File(childDir, "a.txt");
  Assert.assertTrue(a.createNewFile(), "can't create: " + a.getAbsolutePath());

  final VirtualFile dir = myLocalFileSystem.refreshAndFindFileByIoFile(file);
  final VirtualFile childFile = myLocalFileSystem.refreshAndFindFileByIoFile(a);

  Assert.assertNotNull(dir);
  Assert.assertNotNull(childFile);

  final VirtualFile result = VcsFileUtil.getPossibleBase(childFile, dirName.split("/"));
  Assert.assertEquals(result, dir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitUpperDirectorySearchTest.java

示例3: getBase

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
public static <T> T getBase(final FilePathMerger<T> merger, final String path) {
  final boolean caseSensitive = SystemInfo.isFileSystemCaseSensitive;
  final String[] parts = path.replace("\\", "/").split("/");
  for (int i = parts.length - 1; i >=0; --i) {
    final String part = parts[i];
    if ("".equals(part) || ".".equals(part)) {
      continue;
    } else if ("..".equals(part)) {
      if (! merger.up()) return null;
      continue;
    }
    final String vfName = merger.getCurrentName();
    if (vfName == null) return null;
    if ((caseSensitive && vfName.equals(part)) || ((! caseSensitive) && vfName.equalsIgnoreCase(part))) {
      if (! merger.up()) return null;
    } else {
      return null;
    }
  }
  return merger.getResult();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PathMerger.java

示例4: isDisabled

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public boolean isDisabled(final String moduleName, final String url) {
  if (myModuleElements.isEmpty()) return true;

  DisabledAutodetectionInModuleElement element = findElement(moduleName);
  if (element == null) return false;

  if (element.isDisableInWholeModule() || element.getFiles().contains(url)) {
    return true;
  }
  for (String directoryUrl : element.getDirectories()) {
    if (!directoryUrl.endsWith("/")) {
      directoryUrl += "/";
    }
    if (url.startsWith(directoryUrl) || !SystemInfo.isFileSystemCaseSensitive && StringUtil.startsWithIgnoreCase(url, directoryUrl)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DisabledAutodetectionByTypeElement.java

示例5: copy

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Override
public void copy(@NotNull File src, @NotNull File dst, boolean makeParents, boolean isMove) throws VcsException {
  List<String> parameters = new ArrayList<String>();

  CommandUtil.put(parameters, src);
  CommandUtil.put(parameters, dst, false);
  CommandUtil.put(parameters, makeParents, "--parents");

  // for now parsing of the output is not required as command is executed only for one file
  // and will be either successful or exception will be thrown
  // Use idea home directory for directory renames which differ only by character case on case insensitive file systems - otherwise that
  // directory being renamed will be blocked by svn process
  File workingDirectory =
    isMove && !SystemInfo.isFileSystemCaseSensitive && FileUtil.filesEqual(src, dst) ? CommandUtil.getHomeDirectory() : null;
  execute(myVcs, SvnTarget.fromFile(dst), workingDirectory, getCommandName(isMove), parameters, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CmdCopyMoveClient.java

示例6: checkFsSanity

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private void checkFsSanity() {
  try {
    String path = myProject.getProjectFilePath();
    if (path == null || FileUtil.isAncestor(PathManager.getConfigPath(), path, true)) {
      return;
    }

    boolean actual = FileUtil.isFileSystemCaseSensitive(path);
    LOG.info(path + " case-sensitivity: " + actual);
    if (actual != SystemInfo.isFileSystemCaseSensitive) {
      int prefix = SystemInfo.isFileSystemCaseSensitive ? 1 : 0;  // IDE=true -> FS=false -> prefix='in'
      String title = ApplicationBundle.message("fs.case.sensitivity.mismatch.title");
      String text = ApplicationBundle.message("fs.case.sensitivity.mismatch.message", prefix);
      Notifications.Bus.notify(
        new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, text, NotificationType.WARNING, NotificationListener.URL_OPENING_LISTENER),
        myProject);
    }
  }
  catch (FileNotFoundException e) {
    LOG.warn(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StartupManagerImpl.java

示例7: testLongPattern

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Test
public void testLongPattern() throws Exception {
  final String dirName = SystemInfo.isFileSystemCaseSensitive ? "somedir/long/path" : "somEdir/lonG/path";
  final File file = new File(myProjectFixture.getProject().getBaseDir().getPath(), "somedir");
  FileUtil.delete(file);
  Assert.assertTrue(file.mkdir(), "can't create: " + file.getAbsolutePath());
  final File childDir = new File(file, "long/path/and/a/path/to");
  Assert.assertTrue(childDir.mkdirs(), "can't create: " + childDir.getAbsolutePath());
  final File a = new File(childDir, "a.txt");
  Assert.assertTrue(a.createNewFile(), "can't create: " + a.getAbsolutePath());

  final VirtualFile dir = myLocalFileSystem.refreshAndFindFileByIoFile(file);
  final VirtualFile childFile = myLocalFileSystem.refreshAndFindFileByIoFile(a);

  Assert.assertNotNull(dir);
  Assert.assertNotNull(childFile);

  final VirtualFile result = VcsFileUtil.getPossibleBase(childFile, dirName.split("/"));
  Assert.assertEquals(result, dir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitUpperDirectorySearchTest.java

示例8: getType

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public Type getType() {
  if (myType == null) {
    if (myBeforeRevision == null) {
      myType = Type.NEW;
      return myType;
    }

    if (myAfterRevision == null) {
      myType = Type.DELETED;
      return myType;
    }

    if ((! Comparing.equal(myBeforeRevision.getFile(), myAfterRevision.getFile())) ||
        ((! SystemInfo.isFileSystemCaseSensitive) && VcsFilePathUtil
          .caseDiffers(myBeforeRevision.getFile().getPath(), myAfterRevision.getFile().getPath()))) {
      myType = Type.MOVED;
      return myType;
    }

    myType = Type.MODIFICATION;
  }
  return myType;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:Change.java

示例9: testDoNotAddSameIndexTwice

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testDoNotAddSameIndexTwice() throws Exception {
  MavenIndex local = myIndices.add("local", myRepositoryHelper.getTestDataPath("foo"), MavenIndex.Kind.LOCAL);

  if (!SystemInfo.isFileSystemCaseSensitive) {
    assertSame(local, myIndices.add("local", myRepositoryHelper.getTestDataPath("FOO"), MavenIndex.Kind.LOCAL));
  }
  assertSame(local, myIndices.add("local", myRepositoryHelper.getTestDataPath("foo") + "/\\", MavenIndex.Kind.LOCAL));
  assertSame(local, myIndices.add("local", "  " + myRepositoryHelper.getTestDataPath("foo") + "  ", MavenIndex.Kind.LOCAL));

  MavenIndex remote = myIndices.add("remote", "http://foo.bar", MavenIndex.Kind.REMOTE);

  assertSame(remote, myIndices.add("remote", "HTTP://FOO.BAR", MavenIndex.Kind.REMOTE));
  assertSame(remote, myIndices.add("remote", "http://foo.bar/\\", MavenIndex.Kind.REMOTE));
  assertSame(remote, myIndices.add("remote", "  http://foo.bar  ", MavenIndex.Kind.REMOTE));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:MavenIndicesTest.java

示例10: createStringIntMap

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@NotNull
private static ObjectIntHashMap<String> createStringIntMap(int initialCapacity) {
  if (initialCapacity == -1) {
    initialCapacity = 4;
  }
  return SystemInfo.isFileSystemCaseSensitive
         ? new ObjectIntHashMap<String>(initialCapacity)
         : new ObjectIntHashMap<String>(initialCapacity, CaseInsensitiveStringHashingStrategy.INSTANCE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SourceResolver.java

示例11: getModuleByFilePath

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
@Nullable
private ModuleEx getModuleByFilePath(@NotNull String filePath) {
  for (Module module : myModules.values()) {
    if (SystemInfo.isFileSystemCaseSensitive ? module.getModuleFilePath().equals(filePath) : module.getModuleFilePath().equalsIgnoreCase(filePath)) {
      return (ModuleEx)module;
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ModuleManagerImpl.java

示例12: indexOfFirstDifferentChar

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
private static int indexOfFirstDifferentChar(@NotNull CharSequence s1, int start1, @NotNull String s2, int start2) {
  boolean ignoreCase = !SystemInfo.isFileSystemCaseSensitive;
  int len1 = s1.length();
  int len2 = s2.length();
  while (start1 < len1 && start2 < len2) {
    char c1 = s1.charAt(start1);
    char c2 = s2.charAt(start2);
    if (!StringUtil.charsEqual(c1, c2, ignoreCase)) {
      return start1;
    }
    start1++;
    start2++;
  }
  return start1;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FilePointerPartNode.java

示例13: convertPath

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static String convertPath(final String parent, final String subpath) {
  String convParent = FileUtil.toSystemIndependentName(parent);
  String convPath = FileUtil.toSystemIndependentName(subpath);

  String withSlash = StringUtil.trimEnd(convParent, "/") + "/" + StringUtil.trimStart(convPath, "/");
  return SystemInfo.isFileSystemCaseSensitive ? withSlash : withSlash.toUpperCase();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:FilePathsHelper.java

示例14: testNonCanonicallyNamedFileRoot

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public void testNonCanonicallyNamedFileRoot() throws Exception {
  if (SystemInfo.isFileSystemCaseSensitive) {
    System.err.println("Ignored: case-insensitive FS required");
    return;
  }

  File file = createTestFile(myTempDirectory, "test.txt");
  refresh(file);

  String watchRoot = file.getPath().toUpperCase(Locale.US);
  LocalFileSystem.WatchRequest request = watch(new File(watchRoot));
  try {
    myAccept = true;
    FileUtil.writeToFile(file, "new content");
    assertEvent(VFileContentChangeEvent.class, file.getPath());

    myAccept = true;
    FileUtil.delete(file);
    assertEvent(VFileDeleteEvent.class, file.getPath());

    myAccept = true;
    FileUtil.writeToFile(file, "re-creation");
    assertEvent(VFileCreateEvent.class, file.getPath());
  }
  finally {
    unwatch(request);
    delete(file);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:FileWatcherTest.java

示例15: rename

import com.intellij.openapi.util.SystemInfo; //导入方法依赖的package包/类
public static boolean rename(@NotNull File source, @NotNull String newName) throws IOException {
  File target = new File(source.getParent(), newName);
  if (!SystemInfo.isFileSystemCaseSensitive && newName.equalsIgnoreCase(source.getName())) {
    File intermediate = createTempFile(source.getParentFile(), source.getName(), ".tmp", false, false);
    return source.renameTo(intermediate) && intermediate.renameTo(target);
  }
  else {
    return source.renameTo(target);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:FileUtil.java


注:本文中的com.intellij.openapi.util.SystemInfo.isFileSystemCaseSensitive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。