W3C home > Mailing lists > Public > xproc-dev@w3.org > January 2012

why not in p:exec ... ""If cwd is not specified, the cwd is the same as the xproc file one is running."?

From: Alex Muir <alex.g.muir@gmail.com>
Date: Mon, 16 Jan 2012 14:36:17 +0000
Message-ID: <CAFtPEJZeY5Bi8+nbPnHTUchh6HPSfzcppyjc7Oyw-H5tw_Q16A@mail.gmail.com>
To: XProc Dev <xproc-dev@w3.org>
Hi,

I'm reading that for p:exec "If cwd is not specified, the current working
directory is implementation-defined."

I'm just wondering why one wouldn't want to have implementations do and the
spec read that ""If cwd is not specified, the current working directory is
the same as the xproc file."

I found that the following did not work until I added a cwd and specified
it be the same dir as the xproc file I'm running

   <p:exec command="java"
cwd="/home/alex/UTSWEBClientWork/hg/automation/xproc/"
name="validate-with-rng"
        result-is-xml="false" wrap-result-lines="true">
        <p:with-option name="args" select="concat('-jar ../jing/jing.jar
-c', ' ',
            $relaxNGSchema , ' ', $xmlFileInput)">
            <p:empty/>
        </p:with-option>
    </p:exec>


Wouldn't you want your cwd to always be the xproc file unless otherwise
specified? Why why not?


So anyway then had to get the directory of the current xproc file I'm
running dynamically

<p:directory-list name="tiger">
        <p:with-option name="path" select="'.'"/>
    </p:directory-list>
    <p:group>
        <p:variable name="cwd" select="/c:directory/@*[namespace-uri()='
http://www.w3.org/XML/1998/namespace' and local-name()='base']"/>

        <p:exec command="java"    name="validate-with-rng"
            result-is-xml="false" wrap-result-lines="true">
            <p:with-option name="args" select="concat('-jar
../jing/jing.jar -c', ' ',
                $relaxNGSchema , ' ', $xmlFileInput)">
                <p:empty/>
            </p:with-option>
            <p:with-option name="cwd"
select="replace($cwd,'file:','')"></p:with-option>
        </p:exec>

    </p:group>

Thanks
-- 
Alex Muir
Instructor | Program Organizer - University Technology Student Work
Experience Building
University of the Gambia
http://sites.utg.edu.gm/alex/<https://sites.google.com/a/utg.edu.gm/utsweb/>

Low budget software development benefiting development in the Gambia, West
Africa
Experience of a lifetime, come to Gambia and Join UTSWEB -
http://sites.utg.edu.gm/utsweb/<https://sites.google.com/a/utg.edu.gm/utsweb/>
Received on Monday, 16 January 2012 14:36:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 16 January 2012 14:36:54 GMT