From ab7b0057214ddab3448bc72f87e9435de09e9a41 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Thu, 16 Aug 2007 14:57:26 +0000
Subject: [PATCH] changed method of finding workspace base dir
---
opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java b/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
index ed1e880..d5a889b 100644
--- a/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
+++ b/opends/src/build-tools/org/opends/build/tools/GenerateMessageFile.java
@@ -3,6 +3,7 @@
import org.apache.tools.ant.Task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Location;
import static org.opends.build.tools.Utilities.*;
import org.opends.messages.Category;
import org.opends.messages.Severity;
@@ -29,6 +30,7 @@
import java.util.HashSet;
import java.util.Set;
import java.util.EnumSet;
+import java.util.Hashtable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -695,7 +697,7 @@
* @return true if the class was acutally added to the registry;
* false indicates that the class was already present.
*/
- static private boolean registerMessageDescriptor(String descClassName)
+ private boolean registerMessageDescriptor(String descClassName)
throws IOException
{
boolean classAdded = false;
@@ -711,7 +713,7 @@
return classAdded;
}
- static private boolean isDescriptorRegistered(String descClassName)
+ private boolean isDescriptorRegistered(String descClassName)
throws IOException
{
boolean isRegistered = false;
@@ -727,8 +729,8 @@
return isRegistered;
}
- static private File getRegistryFile() throws IOException {
- File registry = new File(System.getProperty("user.dir"), REGISTRY_FILE_NAME);
+ private File getRegistryFile() throws IOException {
+ File registry = new File(getProjectBase(), REGISTRY_FILE_NAME);
if (!registry.exists()) {
File parent = registry.getParentFile();
if (!parent.exists()) {
@@ -739,12 +741,18 @@
return registry;
}
- private static String unixifyPath(String path) {
+ private File getProjectBase() {
+ Location l = getLocation();
+ File f = new File(l.getFileName());
+ return f.getParentFile();
+ }
+
+ private String unixifyPath(String path) {
return path.replace("\\", "/");
}
private File getStubFile() {
- return new File(System.getProperty("user.dir"), MESSAGES_FILE_STUB);
+ return new File(getProjectBase(), MESSAGES_FILE_STUB);
}
/**
--
Gitblit v1.10.0