From f5e60ba88a28c2df0c9263dd6f999f675fefe4e9 Mon Sep 17 00:00:00 2001
From: Egbert Teeselink <e@teeselink.nl>
Date: Sun, 03 Feb 2013 12:29:50 -0500
Subject: [PATCH] Added support for user-specified command-line parameters to .cmd files
---
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