From af0b7b7871fd41d7ce354df10e0211108467d55a Mon Sep 17 00:00:00 2001 From: zhaopeng <imzhpe@qq.com> Date: Wed, 16 Jan 2013 09:09:09 -0500 Subject: [PATCH] 添加中文语言 --- 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