IJPL-156389 lvcs: fix Local History for WSL projects

GitOrigin-RevId: 932821c3e0c422a1dcfb08d19cf675f16d7559a7
This commit is contained in:
Aleksey Pivovarov
2024-06-21 16:36:33 +02:00
committed by intellij-monorepo-bot
parent fd30803a4e
commit 58af8101d9

View File

@@ -103,7 +103,10 @@ public class IdeaGateway {
public static @NotNull String getNameOrUrlPart(@NotNull VirtualFile file) {
String name = file.getName();
if (file.isInLocalFileSystem() || file.getParent() != null) return name;
if (file.getParent() != null) return name;
if (file.isInLocalFileSystem()) {
return "/".equals(name) ? "" : name; // on Unix FS root name is "/"
}
return VirtualFileManager.constructUrl(file.getFileSystem().getProtocol(), StringUtil.trimStart(name, "/"));
}
@@ -399,7 +402,7 @@ public class IdeaGateway {
return true;
}
String childName = StringUtil.trimStart(getNameOrUrlPart(child), "/"); // on Mac FS root name is "/"
String childName = getNameOrUrlPart(child);
if (!targetPath.startsWith(childName)) return false;
String targetPathRest = targetPath.substring(childName.length());
if (!targetPathRest.isEmpty() && targetPathRest.charAt(0) != '/') return false;