Java Code Examples for com.intellij.util.SystemProperties#getUserHome()

The following examples show how to use com.intellij.util.SystemProperties#getUserHome() . 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: FirefoxUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static File[] getProfilesDirs() {
  final String userHome = SystemProperties.getUserHome();
  if (SystemInfo.isMac) {
    return new File[] {
      new File(userHome, "Library" + File.separator + "Mozilla" + File.separator + "Firefox"),
      new File(userHome, "Library" + File.separator + "Application Support" + File.separator + "Firefox"),
    };
  }
  if (SystemInfo.isUnix) {
    return new File[] {new File(userHome, ".mozilla" + File.separator + "firefox")};
  }

  String localPath = "Mozilla" + File.separator + "Firefox";
  return new File[] {
    new File(System.getenv("APPDATA"), localPath),
    new File(userHome, "AppData" + File.separator + "Roaming" + File.separator + localPath),
    new File(userHome, "Application Data" + File.separator + localPath)
  };
}
 
Example 2
Source File: PathManager.java    From dynkt with GNU Affero General Public License v3.0 6 votes vote down vote up
@NotNull
public static String getPluginsPath() {
	if (ourPluginsPath != null) {
		String tmp9_6 = ourPluginsPath;
		if (tmp9_6 == null) {
			throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null",
					new Object[] { "com/intellij/openapi/application/PathManager", "getPluginsPath" }));
		}
		return tmp9_6;
	}
	if (System.getProperty("idea.plugins.path") != null) {
		ourPluginsPath = getAbsolutePath(trimPathQuotes(System.getProperty("idea.plugins.path")));
	} else if ((SystemInfo.isMac) && (PATHS_SELECTOR != null)) {
		ourPluginsPath = SystemProperties.getUserHome() + File.separator + "Library/Application Support"
				+ File.separator + PATHS_SELECTOR;
	} else {
		ourPluginsPath = getConfigPath() + File.separatorChar + "plugins";
	}
	String tmp159_156 = ourPluginsPath;
	if (tmp159_156 == null) {
		throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null",
				new Object[] { "com/intellij/openapi/application/PathManager", "getPluginsPath" }));
	}
	return tmp159_156;
}
 
Example 3
Source File: SdkVersionSelectionDialog.java    From mule-intellij-plugins with Apache License 2.0 5 votes vote down vote up
public SdkVersionSelectionDialog(JComponent parent, String title, String name, List<String> scalaVersions)
{
    super(parent, false);
    setTitle(title);
    //Create and populate the panel.
    centerPanel = new JPanel(new SpringLayout());

    versionLabel = new JLabel(name, JLabel.TRAILING);
    versionComboBox = new ComboBox(new DefaultComboBoxModel<>(scalaVersions.toArray()));
    versionLabel.setLabelFor(versionComboBox);

    centerPanel.add(versionLabel);
    centerPanel.add(versionComboBox);

    destination = new TextFieldWithBrowseButton();
    destination.addBrowseFolderListener("Select new Mule distribution destination", null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor());
    destinationLabel = new JLabel("Destination:", JLabel.TRAILING);
    destinationLabel.setLabelFor(destination);

    //By default, should be ~/mule-distro
    File distro = new File(SystemProperties.getUserHome(), "mule-distro");
    destination.setText(distro.getAbsolutePath());

    centerPanel.add(destinationLabel);
    centerPanel.add(destination);

    //Lay out the panel.
    SpringUtilities.makeCompactGrid(centerPanel,
            2, 2, //rows, cols
            6, 6,        //initX, initY
            6, 6);       //xPad, yPad

    init();
}
 
Example 4
Source File: DefaultPaths.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public String getDocumentsDir() {
  String userHome = SystemProperties.getUserHome();
  // some OS-es can have documents dir inside user home, for example Ubuntu
  File file = new File(userHome, "Documents");
  if (file.exists()) {
    return userHome + File.separatorChar + "Documents" + File.separatorChar + ourDefaultPrefix;
  }
  return userHome + File.separatorChar + ourDefaultPrefix + " Project";
}
 
Example 5
Source File: OutOfMemoryDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("SSBasedInspection")
private void snapshot() {
  enableControls(false);
  myDumpMessageLabel.setVisible(true);
  myDumpMessageLabel.setText("Dumping memory...");

  Runnable task = () -> {
    TimeoutUtil.sleep(250);  // to give UI chance to update
    String message = "";
    try {
      String name = ApplicationNamesInfo.getInstance().getFullProductName().replace(' ', '-').toLowerCase(Locale.US);
      String path = SystemProperties.getUserHome() + File.separator + "heapDump-" + name + '-' + System.currentTimeMillis() + ".hprof.zip";
      MemoryDumpHelper.captureMemoryDumpZipped(path);
      message = "Dumped to " + path;
    }
    catch (Throwable t) {
      message = "Error: " + t.getMessage();
    }
    finally {
      final String _message = message;
      SwingUtilities.invokeLater(() -> {
        myDumpMessageLabel.setText(_message);
        enableControls(true);
      });
    }
  };
  new Thread(task, "OOME Heap Dump").start();
}
 
Example 6
Source File: ProjectUtil.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Nullable
public static VirtualFile findProjectBaseDir(@NotNull Project project) {
    String projectDir = project.getBasePath();
    if (projectDir == null) {
        projectDir = SystemProperties.getUserHome();
        if (projectDir == null) {
            projectDir = "/";
        }
    }
    return VfsUtil.findFileByIoFile(new File(projectDir), false);
}
 
Example 7
Source File: Unity3dBundleType.java    From consulo-unity3d with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public Collection<String> suggestHomePaths()
{
	List<String> paths = new SmartList<>();
	if(SystemInfo.isMac)
	{
		paths.add("/Applications/Unity/Unity.app");
		File hubPath = new File("/Applications/Unity/Hub/Editor");
		if(hubPath.exists())
		{
			for(File versionPath : hubPath.listFiles())
			{
				File unityApp = new File(versionPath, "Unity.app");
				if(unityApp.exists())
				{
					paths.add(unityApp.getPath());
				}
			}
		}
	}
	else if(SystemInfo.isWindows)
	{
		// x64 windows
		paths.add("C:/Program Files (x86)/Unity");
		// x32 windows
		paths.add("C:/Program Files/Unity");
	}
	else if(SystemInfo.isLinux)
	{
		paths.add("/opt/Unity");

		File unityHub = new File(SystemProperties.getUserHome(), "Unity/Hub/Editor/");
		if(unityHub.exists())
		{
			for (File file : unityHub.listFiles())
			{
				if(file.isDirectory())
				{
					paths.add(file.getAbsolutePath());
				}
			}
		}
	}
	return paths;
}
 
Example 8
Source File: BlazeEditProjectViewControl.java    From intellij with Apache License 2.0 4 votes vote down vote up
private static File getDefaultProjectsDirectory() {
  final String userHome = SystemProperties.getUserHome();
  String productName = ApplicationNamesInfo.getInstance().getLowercaseProductName();
  return new File(userHome, productName.replace(" ", "") + "Projects");
}
 
Example 9
Source File: MuleSdkSelectionDialog.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
@NotNull
private File getUserHome() {
    return new File(SystemProperties.getUserHome());
}
 
Example 10
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getLocalSettingsDir() {
  String userHome = SystemProperties.getUserHome();
  return userHome + File.separatorChar + ".consulo_settings" + File.separatorChar + "system";
}
 
Example 11
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getRoamingSettingsDir() {
  String userHome = SystemProperties.getUserHome();
  return userHome + File.separatorChar + ".consulo_settings" + File.separatorChar + "config";
}
 
Example 12
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected String getDocumentsDirNoPrefix() {
  return SystemProperties.getUserHome() + "/Documents";
}
 
Example 13
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public File getExternalPlatformDirectory(@Nonnull File defaultPath) {
  return new File(SystemProperties.getUserHome(), "Library/Application Support/Consulo Platform");
}
 
Example 14
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected String getLocalSettingsDirNoPrefix() {
  return SystemProperties.getUserHome() + "/Library/Caches";
}
 
Example 15
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected String getRoamingSettingsDirNoPrefix() {
  return SystemProperties.getUserHome() + "/Library/Preferences";
}
 
Example 16
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getRoamingPluginsDir() {
  return SystemProperties.getUserHome() + "/Library/Application Support/" + ourDefaultPrefix;
}
 
Example 17
Source File: DefaultPaths.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getLocalLogsDir() {
  return SystemProperties.getUserHome() + "/Library/Logs/" + ourDefaultPrefix;
}