From 93d506581010cdb6308ae3d282a8bc513966d70d Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Tue, 15 Jan 2013 22:41:20 -0500 Subject: [PATCH] Support --baseFolder parameter and small data reorganization --- src/com/gitblit/utils/FileUtils.java | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/com/gitblit/utils/FileUtils.java b/src/com/gitblit/utils/FileUtils.java index 0834867..a21b512 100644 --- a/src/com/gitblit/utils/FileUtils.java +++ b/src/com/gitblit/utils/FileUtils.java @@ -274,4 +274,19 @@ return path.getAbsoluteFile(); } } + + public static File resolveParameter(String parameter, File aFolder, String path) { + if (aFolder == null) { + // strip any parameter reference + path = path.replace(parameter, "").trim(); + if (path.length() > 0 && path.charAt(0) == '/') { + // strip leading / + path = path.substring(1); + } + } else if (path.contains(parameter)) { + // replace parameter with path + path = path.replace(parameter, aFolder.getAbsolutePath()); + } + return new File(path); + } } -- Gitblit v1.9.1