[Cook] Scratch directory/file creation and cleanup

Jerry Pendergraft jerry at endocardial.com
Sat Aug 3 05:25:41 EST 2002


-- 
Jerry Pendergraft                        jerry.pendergraft at endocardial.com
Endocardial Solutions                    voice: 651-523-6935
1350 Energy Lane, Suite 110                fax: 651-644-7897
St Paul, MN 55108-5254

On Fri, 2 Aug 2002, Fredrick Paul Eisele wrote:

> I need to create a temp directory within a rule.
> I have a function ...
> 
> 
> a: b { local WIP = [workdir "ABC-"];  rm -rf [WIP]; }
I would suggest something like:
a: b: {
    local pid = [collect "/bin/echo $$"];
    local WIP = [catenate "/tmp/ABC-" [pid]];
    mkdir [WIP]; set clearstat
    .... use of directory
    rm -rf [WIP];
}
This will get a unique name for each recipe invocation. From the rm I
assume that is what you want.
You could of course put the name gen in a function if you want.
I would leave the mkdir and rm together though just so nothin is hidden
from the future reader.

> 
> _______________________________________________
> Cook-users mailing list
> Cook-users at auug.org.au
> http://www.auug.org.au/mailman/listinfo/cook-users
> 

--
Jerry Pendergraft                        jerry.pendergraft at endocardial.com
Endocardial Solutions                    voice: 651-523-6935
1350 Energy Lane, Suite 110                fax: 651-644-7897
St Paul, MN 55108-5254




More information about the Cook-users mailing list