summaryrefslogtreecommitdiff
path: root/xml/impl/src/org/jetbrains/builtInWebServer/PathInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'xml/impl/src/org/jetbrains/builtInWebServer/PathInfo.java')
-rw-r--r--xml/impl/src/org/jetbrains/builtInWebServer/PathInfo.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/xml/impl/src/org/jetbrains/builtInWebServer/PathInfo.java b/xml/impl/src/org/jetbrains/builtInWebServer/PathInfo.java
new file mode 100644
index 000000000000..b55b16be84b2
--- /dev/null
+++ b/xml/impl/src/org/jetbrains/builtInWebServer/PathInfo.java
@@ -0,0 +1,47 @@
+package org.jetbrains.builtInWebServer;
+
+import com.intellij.openapi.vfs.VfsUtilCore;
+import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public class PathInfo {
+ private final VirtualFile child;
+ private final VirtualFile root;
+ String moduleName;
+
+ private String computedPath;
+
+ public PathInfo(@NotNull VirtualFile child, @NotNull VirtualFile root, @Nullable String moduleName) {
+ this.child = child;
+ this.root = root;
+ this.moduleName = moduleName;
+ }
+
+ public PathInfo(@NotNull VirtualFile child, @NotNull VirtualFile root) {
+ this(child, root, null);
+ }
+
+ @NotNull
+ public VirtualFile getChild() {
+ return child;
+ }
+
+ @NotNull
+ public VirtualFile getRoot() {
+ return root;
+ }
+
+ @Nullable
+ public String getModuleName() {
+ return moduleName;
+ }
+
+ @NotNull
+ public String getPath() {
+ if (computedPath == null) {
+ computedPath = (moduleName == null ? "" : moduleName + '/') + VfsUtilCore.getRelativePath(child, root, '/');
+ }
+ return computedPath;
+ }
+} \ No newline at end of file