tags:

views:

412

answers:

3

hi all,

when i run a process in unix the path points to /abc/1/2/3

I am setting a property in an xml for a process which run in path. One property i have

< property name="log.path" value="/abc/4/5"/ >

Problem is that i cannot give absolute path("/abc/1/2/3") as above. i have to give something like "../../../4/5".

< property name="log.path" value="../../../4/5"/ >

my questions is why the above evaluation is not working? currently it is considering the path given in value as constant.

A: 

Check out http://en.wikipedia.org/wiki/Path_(computing)

In short, what you are doing is absolutely right. If it is not working, the problem may be that when the application executes, it executes in a different folder than the one you are expecting.

Can be resolved if you provide more details

Tanmay

Tanmay
+2  A: 

XML is just a standardised format for storing structured data... it specifies nothing about what element attributes mean, since it has no idea that (for example) that attribute is semantically a Unix-type path.

So this isn't really a question about XML, it's about how the application that's reading the XML handles specified paths. For example (as mentioned), what directory it considers current will affect the interpretation of relative paths... assuming that relative paths are actually parsed correctly by the application.

andybuckley
A: 

Ok, let's analyze this.

when i run a process in unix the path points to /abc/1/2/3

Now does the executable for the process exist at /abc/1/2/3 or is /abc/1/2/3 the current working directory for your process?

If current working directory for the process is /abc/1/2/3 and the process reads that XML file and tries to use the path in there directly with a system call like open then the relative path notation ../../../4/5 should work. If however the path /abc/1/2/3 is not the current working directory and just the location of the executable then ../../../4/5 can not work as the current working directory is not /abc/1/2/3 and relative paths always work against the current working directory.

Make sure to check if /abc/1/2/3 is truly the current working directory and not just the executable location.

lothar