Hi,

I am fooling around with a build-tool and have found something reguarding 
prefix upon properties, with I think, is a bit annoying and deserve a twist...

     ----

To explain, I have a setup along these lines: A property-file with a fixed set 
of properties - it is always called "something.prop" - which may exist in 
multiple copies. In certain situations, the same property from e.g. two copies 
should be read and to do this, a prefix must be added like -

  <property
    file="${system.dir}/Application Something/conf/something.prop"
    prefix="system|something.prop|"
  />

  <property
    file="${user.home}/Application Something/conf/something.prop"
    prefix="user|something.prop|"
  />

Some other character than '.' - like '|' og ':' is desirable, because then 
there is a clear distinction between what is and is not the name of the file 
(the '.' character is natural within a file-name!).

However, since the prefix does not end with '.', then the character is added 
implicitly (as the documentation tells). Then e.g. a property "ext.dir" from 
the "something.prop" set of properties can *not* be addressed like -

<echo>${system|something.prop|ext.dir}</echo>

- but requires the form -

<echo>${system|something.prop|.ext.dir}</echo>

This, I think, is annoying!

     -----

I have not examined, what Java property-files allow for the name of a property, 
but within Ant itself, characters like '|' and ':' could really be quite 
useful!! There does not appear to be any but's about these in actual use.

Examples of possible solutions/work-arounds:

1) Add a repair-attribute 'noImplicitPrefixSuffix="true"'.
2) Add a attribute "prefix2" with the exact same behaviour as "prefix", but 
with no implicit dot.
3) Lets the task add '.' if and only if the last character of the prefix is 
either an alpha-numeric character or a digit.

In my mind, 2) is the clean solution.

     -----

Please consider my suggestion of avoiding the implicit dot.

Regards,
Morten Sabroe Mortensen

Reply via email to