diff --git a/platform/projectModel-api/src/com/intellij/openapi/project/ProjectUtilCore.kt b/platform/projectModel-api/src/com/intellij/openapi/project/ProjectUtilCore.kt index 2932d9b74c4e..d90eca52f989 100644 --- a/platform/projectModel-api/src/com/intellij/openapi/project/ProjectUtilCore.kt +++ b/platform/projectModel-api/src/com/intellij/openapi/project/ProjectUtilCore.kt @@ -11,13 +11,14 @@ import com.intellij.openapi.roots.libraries.LibraryUtil import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.vfs.LocalFileProvider import com.intellij.openapi.vfs.VirtualFile +import com.intellij.util.PathUtil import com.intellij.util.PlatformUtils -fun displayUrlRelativeToProject(file: VirtualFile, url: String, project: Project, includeFilePath: Boolean, moduleOnTheLeft: Boolean): String { +fun displayUrlRelativeToProject(file: VirtualFile, url: String, project: Project, isIncludeFilePath: Boolean, moduleOnTheLeft: Boolean): String { var result = url - if (includeFilePath) { - val projectHomeUrl = project.baseDir?.presentableUrl + if (isIncludeFilePath) { + val projectHomeUrl = PathUtil.toSystemDependentName(project.basePath) result = when { projectHomeUrl != null && result.startsWith(projectHomeUrl) -> "...${result.substring(projectHomeUrl.length)}" else -> FileUtil.getLocationRelativeToUserHome(file.presentableUrl) @@ -35,8 +36,10 @@ fun displayUrlRelativeToProject(file: VirtualFile, url: String, project: Project } } - if (PlatformUtils.isCidr() || PlatformUtils.isRider()) // see PredefinedSearchScopeProviderImpl.getPredefinedScopes for the other place to fix. + // see PredefinedSearchScopeProviderImpl.getPredefinedScopes for the other place to fix. + if (PlatformUtils.isCidr() || PlatformUtils.isRider()) { return result + } val module = ModuleUtilCore.findModuleForFile(file, project) return when { @@ -53,5 +56,5 @@ val Project.isExternalStorageEnabled: Boolean } val manager = ServiceManager.getService(this, ExternalStorageConfigurationManager::class.java) ?: return false - return manager.isEnabled() || (ApplicationManager.getApplication()?.isUnitTestMode ?: false) + return manager.isEnabled || (ApplicationManager.getApplication()?.isUnitTestMode ?: false) } \ No newline at end of file