Alan Stewart wrote:
On 10 Jul 2004 at 11:41, Dean Arnold wrote:
Is there a scriptable way to locate and delete the
temp directory used to cache the perl distro for an executable
built with pp ?
I don't mean pp -C, as I do want to persist the cache as long
as the app is installed. But when the user uninstalls, it would
be nice to clean out all those temp files.
Does pp/PAR generate its temp directory name at build time,
or at install time ? Or maybe that needs to be added as
a command line switch so the user can supply a fixed
directory name ? Are there any identifiable crumbs
in the temp directory that can be used to identify
something as belonging to a specific pp generated application ?
TIA,
Dean Arnold
Presicient Corp.
The executable does generate its temp dir name at run time, but it is entirely
predictable before (and after :) When not using -C, it is $ENV{TEMP} plus "\par-$USER"
(where $USER is the login name) plus "\cache-" plus the SHA1 hash of the executable.
For example:
c:\temp\par-astewart\cache-1a6deca675169d47838e9faf5a23cfb644890bad
on my environment, where:
TEMP=c:\temp
USERNAME=astewart
and the SHA1 for the executable is 1a6deca675169d47838e9faf5a23cfb644890bad. You can
compute the SHA1 as soon as you've run pp to put in an un-install routine.
On the other hand, if that's too much, you can set PAR_GLOBAL_TEMP to something and the
PAR will unpack right there, without any par-$USER or cache- xxx stuff. Of course, all
PAR executables will unpack there.
On the third hand, if you are not using "pp -d", the unpacked executable in the temp
cache has the same name as the original PAR executable, you could search TEMP for it
and delete whatever directory you found it in.
Note that if you edit the application and re-run pp, the application has a different
SHA1 hash and uses a different temp dir.
Alan Stewart
Thanks. One minor adjustment for Windows users: $USER is %USERNAME%
(at least on XP, have to check 2K), and it appears PAR replaces
spaces in the username with underscores (but not in the rest of the
constructed path).
If/when I manage to figure out a script solution based on that, I'll post it
here.
Dean Arnold
Presicient Corp.