You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by Tilman Giese <ti...@gmx.de> on 2003/03/16 13:55:31 UTC
Path issue
I do not know, whether this is a bug or an enhancement request, but I
have a little problem with paths. I wanted to keep my gump configuration
completely separate from my checked out gump cvs directory and placed
everything in a directory somewhere else. The host configuration file is
/home/work/gump/configuration/hostname.xml and includes a lot of other
files, e.g /home/work/gump/configuration/projects/project1.xml, so I
specified the relative path projects/project1.xml in hostname.xml. But
when running gen.sh, I get the error message
/home/gump-cvs/projects/project1.xml could not be found. I would
appreciate if gump could take the basedir of the host configuration file
to resolve includes.
Tilman Giese
Re: Path issue
Posted by Tilman Giese <ti...@gmx.de>.
Sam Ruby wrote:
> What if source is already fully qualified? What if source is a URL?
OK. I switched to using URLs, but when I now invoke
./gen.sh http://gump.development.local/configuration/ramses.xml
I get the following error:
[...]
Publishing http://gump.development.local/configuration/ramses.xml
- ../http://gump.development.local/configuration/ramses.xml
Can't open ../http://gump.development.local/configuration/ramses.xml: No
such file or directory at map.pl line 2.
- module_ant.xml
It seems that gump does not take care of URLs here, doesn't it?
Tilman Giese
Re: Path issue
Posted by Sam Ruby <ru...@apache.org>.
Tilman Giese wrote:
> +
> + if (this.basedir != null) {
> + source = this.basedir + source;
> + }
What if source is already fully qualified? What if source is a URL?
- Sam Ruby
Re: Path issue
Posted by Tilman Giese <ti...@gmx.de>.
Maybe something like that would already be sufficient:
--- Jenny.java 2003-03-16 15:47:31.000000000 +0100
+++ Jenny.java.orig 2003-03-16 15:45:30.000000000 +0100
@@ -90,6 +90,9 @@
/** Indicates whether extrenal references should be followed or not */
private boolean online = true;
+ /** basedir of workspace configuration file */
+ private String basedir = null;
+
DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
TransformerFactory tFactory = TransformerFactory.newInstance();
@@ -101,6 +104,11 @@
private Document parse(String source) throws Exception {
try {
DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
+
+ if (this.basedir != null) {
+ source = this.basedir + source;
+ }
+
return dBuilder.parse(source);
} catch (SAXParseException e) {
System.err.print("Error parsing file " + source);
@@ -379,6 +387,13 @@
*/
private Jenny(String source, boolean online) throws Exception {
this.online = online;
+
+ // set basedir if available
+ this.basedir = source.substring(0, source.lastIndexOf('/') + 1);
+
+ // remove basedir from workspace file
+ source = source.substring(source.lastIndexOf('/'));
+
// Obtain the date to be used
Date lastModified = new Date();
Tilman Giese
try {