String (@NotNull String agentPath, @NotNull String agentName, @NotNull String copyDirName, @Nullable String agentPathPropertyKey, @Nullable FileFilter fileFilter) { String agentContainingDir; String userDefined = agentPathPropertyKey == null ? null : System.getProperty(agentPathPropertyKey); if (userDefined != null && new File(userDefined).exists()) { agentContainingDir = userDefined; } else { agentContainingDir = new File(agentPath).getParent(); } if (agentContainingDir.contains(" ")) { String res = tryCopy(agentContainingDir, agentName, new File(PathManager.getSystemPath(), copyDirName), fileFilter); if (res == null) { try { res = tryCopy(agentContainingDir, agentName, FileUtil.createTempDirectory(copyDirName, "jars"), fileFilter); if (res == null) { String message = "agent not used since the agent path contains spaces: " + agentContainingDir; if (agentPathPropertyKey != null) { message += "\nOne can move the agent libraries to a directory with no spaces in path and specify its path in idea.properties as " + agentPathPropertyKey + "=<path>"; } LOG.info(message); } } catch (IOException e) { LOG.info(e); } } return res; } return agentContainingDir; }