コード例 #1
0
 public static boolean isAvailable() {
   return IdeaWin32.isAvailable();
 }
コード例 #2
0
  static void loadSystemLibraries(final Logger log) {
    // load JNA and Snappy in own temp directory - to avoid collisions and work around no-exec /tmp
    final File ideaTempDir = new File(PathManager.getSystemPath(), "tmp");
    if (!(ideaTempDir.mkdirs() || ideaTempDir.exists())) {
      throw new RuntimeException("Unable to create temp directory '" + ideaTempDir + "'");
    }

    final String javaTempDir = System.getProperty(JAVA_IO_TEMP_DIR);
    try {
      System.setProperty(JAVA_IO_TEMP_DIR, ideaTempDir.getPath());
      if (System.getProperty("jna.nosys") == null && System.getProperty("jna.nounpack") == null) {
        // force using bundled JNA dispatcher (if not explicitly stated)
        System.setProperty("jna.nosys", "true");
        System.setProperty("jna.nounpack", "false");
      }
      try {
        final long t = System.currentTimeMillis();
        log.info(
            "JNA library loaded ("
                + (Native.POINTER_SIZE * 8)
                + "-bit) in "
                + (System.currentTimeMillis() - t)
                + " ms");
      } catch (Throwable t) {
        logError(log, "Unable to load JNA library", t);
      }
    } finally {
      System.setProperty(JAVA_IO_TEMP_DIR, javaTempDir);
    }

    if (!NO_SNAPPY) {
      if (System.getProperty(SnappyLoader.KEY_SNAPPY_TEMPDIR) == null) {
        System.setProperty(SnappyLoader.KEY_SNAPPY_TEMPDIR, ideaTempDir.getPath());
      }
      try {
        final long t = System.currentTimeMillis();
        loadSnappyForJRockit();
        log.info(
            "Snappy library loaded ("
                + Snappy.getNativeLibraryVersion()
                + ") in "
                + (System.currentTimeMillis() - t)
                + " ms");
      } catch (Throwable t) {
        logError(log, "Unable to load Snappy library", t);
      }
    }

    if (SystemInfo.isWin2kOrNewer) {
      IdeaWin32.isAvailable(); // logging is done there
    }

    if (SystemInfo.isWin2kOrNewer && !isHeadless) {
      try {
        System.loadLibrary(SystemInfo.isAMD64 ? "focusKiller64" : "focusKiller");
        log.info("Using \"FocusKiller\" library to prevent focus stealing.");
      } catch (Throwable t) {
        log.info("\"FocusKiller\" library not found or there were problems loading it.", t);
      }
    }
  }