Andy Black wrote:
> On 10/1/2009 8:04 AM, Hussein Shafie wrote:
>> Andy Black wrote:
>>
>>> I recently noticed that the %P macro variable on Windows behaves
>>> differently when the path is at the top (or root) directory than when
>>> the path contains a directory. When it is at the root, it ends with a
>>> backslash (e.g. "E:\") whereas when it contains a directory, it does not
>>> end with a backslash (e.g. "E:\My Data"). ..
>> ...The filename of a directory is *not* expected to end with '/' (or '\' on
>> Windows). That's why this does not need to be documented,
>>
>> Note the filename of the root directory of a filesystem is always
>> singular. This filename is '/' on Unix and something like c:\ on
>> windows. That is, %P necessarily ends with '/' (or '\' on Windows) for
>> the root directory of a filesystem.
>>
>
> Thanks, Hussein, for the good explanation.
>
> I'm wondering if it would be possible for XXE to detect this internally
> and remove the final slash for when the filename is at the root. The
> reason is that then when one has a sequence like %{P}%{S}, one never
> gets double slashes when %{P} happens to be at the root. I had to do
> some fancy footwork in my commands to overcome this issue. It was a
> problem for one command
>
> <cfg:command name="run" parameter="[Windows] del
> "%{P}%{S}XLingPaperPDFTemp%{S}%{R}.txt""/>
>
> where it failed to run if the file was at the top directory. It gave a
> message of "The network path was not found" presumably because it saw
> the "\\" and interpreted it as network path.
>
> Thanks for considering this request.
I'm sorry but we'll not change current behavior[*]. What if a command
really needs to act on a directory? In such case the %P of the root
directory would be substituted with something like "C:", which means
nothing at all.
---
[*] Moreover this would break a large number of existing commands. The
only solution would be to support a new variable, e.g. %Q.