Java Code Examples for com.intellij.openapi.util.SystemInfo#is32Bit()

The following examples show how to use com.intellij.openapi.util.SystemInfo#is32Bit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TabNineFinder.java    From tabnine-intellij with MIT License 6 votes vote down vote up
static String getTargetName() {
    String is32or64;
    if (SystemInfo.is32Bit) {
        is32or64 = "i686";
    } else {
        is32or64 = "x86_64";
    }
    String platform;
    if (SystemInfo.isWindows) {
        platform = "pc-windows-gnu";
    } else if (SystemInfo.isMac) {
        platform = "apple-darwin";
    } else if (SystemInfo.isLinux) {
        platform = "unknown-linux-musl";
    } else if (SystemInfo.isFreeBSD) {
        platform = "unknown-freebsd";
    } else {
        throw new RuntimeException("Platform was not recognized as any of Windows, macOS, Linux, FreeBSD");
    }
    return is32or64 + "-" + platform;
}
 
Example 2
Source File: VisualStudioTfvcClient.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * Tries to detect path to the latest available TFVC client from a set of hardcoded locations.
 *
 * @return detected path or null.
 */
@Nullable
public static Path detectClientPath() {
    if (!SystemInfo.isWindows) return null;
    String programFilesPath = SystemInfo.is32Bit ? System.getenv("ProgramFiles") : System.getenv("ProgramFiles(x86)");
    if (StringUtils.isEmpty(programFilesPath))
        programFilesPath = "C:\\Program Files (x86)";
    Path visualStudioPath = Paths.get(programFilesPath, "Microsoft Visual Studio");
    for (String vsVersion : SUPPORTED_VS_VERSIONS) {
        Path versionPath = visualStudioPath.resolve(vsVersion);
        if (!versionPath.toFile().isDirectory()) continue;
        for (String vsEdition : SUPPORTED_VS_EDITIONS) {
            Path editionPath = versionPath.resolve(vsEdition);
            Path tfExePath = editionPath.resolve(TF_EXE_PATH_RELATIVE_TO_EDITION_ROOT);
            if (tfExePath.toFile().isFile()) return tfExePath;
        }
    }

    return null;
}
 
Example 3
Source File: JnaUnixMediatorImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public FileAttributes getAttributes(@Nonnull String path) {
  Memory buffer = new Memory(256);
  int res = SystemInfo.isLinux ? myLibC.__lxstat64(STAT_VER, path, buffer) : myLibC.lstat(path, buffer);
  if (res != 0) return null;

  int mode = getModeFlags(buffer) & LibC.S_MASK;
  boolean isSymlink = (mode & LibC.S_IFMT) == LibC.S_IFLNK;
  if (isSymlink) {
    if (!loadFileStatus(path, buffer)) {
      return FileAttributes.BROKEN_SYMLINK;
    }
    mode = getModeFlags(buffer) & LibC.S_MASK;
  }

  boolean isDirectory = (mode & LibC.S_IFMT) == LibC.S_IFDIR;
  boolean isSpecial = !isDirectory && (mode & LibC.S_IFMT) != LibC.S_IFREG;
  long size = buffer.getLong(myOffsets[OFF_SIZE]);
  long mTime1 = SystemInfo.is32Bit ? buffer.getInt(myOffsets[OFF_TIME]) : buffer.getLong(myOffsets[OFF_TIME]);
  long mTime2 = myCoarseTs ? 0 : SystemInfo.is32Bit ? buffer.getInt(myOffsets[OFF_TIME] + 4) : buffer.getLong(myOffsets[OFF_TIME] + 8);
  long mTime = mTime1 * 1000 + mTime2 / 1000000;

  boolean writable = ownFile(buffer) ? (mode & LibC.WRITE_MASK) != 0 : myLibC.access(path, LibC.W_OK) == 0;

  return new FileAttributes(isDirectory, isSpecial, isSymlink, false, size, mTime, writable);
}
 
Example 4
Source File: JnaUnixMediatorImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
JnaUnixMediatorImpl() throws Exception {
  if (SystemInfo.isLinux) {
    if ("arm".equals(SystemInfo.OS_ARCH)) {
      if (SystemInfo.is32Bit) {
        myOffsets = LINUX_ARM;
      }
      else {
        throw new IllegalStateException("AArch64 architecture is not supported");
      }
    }
    else if ("ppc".equals(SystemInfo.OS_ARCH)) {
      myOffsets = SystemInfo.is32Bit ? LNX_PPC32 : LNX_PPC64;
    }
    else {
      myOffsets = SystemInfo.is32Bit ? LINUX_32 : LINUX_64;
    }
  }
  else if (SystemInfo.isMac | SystemInfo.isFreeBSD) {
    myOffsets = SystemInfo.is32Bit ? BSD_32 : BSD_64;
  }
  else if (SystemInfo.isSolaris) {
    myOffsets = SystemInfo.is32Bit ? SUN_OS_32 : SUN_OS_64;
  }
  else {
    throw new IllegalStateException("Unsupported OS/arch: " + SystemInfo.OS_NAME + "/" + SystemInfo.OS_ARCH);
  }

  myLibC = (LibC)Native.loadLibrary("c", LibC.class);
  myUid = myLibC.getuid();
  myGid = myLibC.getgid();
}
 
Example 5
Source File: DefaultIdeaErrorLogger.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void processMappingFailed(IdeaLoggingEvent event) throws InterruptedException, InvocationTargetException {
  if (!ourMappingFailedNotificationPosted && SystemInfo.isWindows && SystemInfo.is32Bit) {
    ourMappingFailedNotificationPosted = true;
    @SuppressWarnings("ThrowableResultOfMethodCallIgnored") String exceptionMessage = event.getThrowable().getMessage();
    String text = exceptionMessage + "<br>Possible cause: unable to allocate continuous memory chunk of necessary size.<br>" + "Reducing JVM maximum heap size (-Xmx) may help.";
    Notifications.Bus.notify(new Notification("Memory", "Memory Mapping Failed", text, NotificationType.WARNING), null);
  }
}