summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/utils/StringUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/gitblit/utils/StringUtils.java')
-rw-r--r--src/com/gitblit/utils/StringUtils.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/gitblit/utils/StringUtils.java b/src/com/gitblit/utils/StringUtils.java
index fd6ca98b..2a10a59a 100644
--- a/src/com/gitblit/utils/StringUtils.java
+++ b/src/com/gitblit/utils/StringUtils.java
@@ -134,4 +134,12 @@ public class StringUtils {
}
return "";
}
+
+ public static String getRelativePath(String basePath, String fullPath) {
+ String relativePath = fullPath.substring(basePath.length()).replace('\\', '/');
+ if (relativePath.charAt(0) == '/') {
+ relativePath = relativePath.substring(1);
+ }
+ return relativePath;
+ }
}