File (@NotNull File systemRoot, @NotNull String projectPath, @NotNull Function<? super String, Integer> hashFunction) { projectPath = FileUtil.toCanonicalPath(projectPath); String name; final int locationHash; final Path rootFile = Paths.get(projectPath); if (!Files.isDirectory(rootFile) && projectPath.endsWith(".ipr")) { name = StringUtil.trimEnd(rootFile.getFileName().toString(), ".ipr"); locationHash = hashFunction.apply(projectPath); } else { Path directoryBased; if (rootFile.endsWith(PathMacroUtil.DIRECTORY_STORE_NAME)) { directoryBased = rootFile; } else { directoryBased = rootFile.resolve(PathMacroUtil.DIRECTORY_STORE_NAME); } name = PathUtilRt.suggestFileName(JpsProjectLoader.getDirectoryBaseProjectName(directoryBased)); locationHash = hashFunction.apply(directoryBased.toString()); } return new File(systemRoot, StringUtil.toLowerCase(name) + "_" + Integer.toHexString(locationHash)); }