[NTG-context] Bug in ctxtools --purge

Hans Hagen pragma at wxs.nl
Thu Oct 19 00:56:20 CEST 2006


Aditya Mahajan wrote:
> Hi Hans,
>
> ctxtools --purge file.tex does not behave the same as
> ctxtools --purge file (no extension). This causes texexec --purge 
> filename to misbehave.
>
> With ctxtools --purge test-04.tex I get
>
> f:\tmp\context\test>ctxtools --purge test-04.tex
> CtxTools | purging temporary files : test-04.tex
> CtxTools | checking files that match 'test-04.tex-*.*'
> CtxTools | checking files that match 'test-04.tex.*'
> CtxTools | removed files : 0
> CtxTools | kept files : 0
> CtxTools | persistent files : 0
> CtxTools | reclaimed bytes : 0
>
> which does not delete the temp files. However with ctxtools --purge 
> test-04 the temp files are deleted.
>
> f:\tmp\context\test>ctxtools --purge test-04
> CtxTools | purging temporary files : test-04
> CtxTools | checking files that match 'test-04-*.*'
> CtxTools | checking files that match 'test-04.*'
> CtxTools | removed : test-04-mpgraph.mp
> CtxTools | removed : test-04.tui
> CtxTools | removed : test-04.log
> CtxTools | removed : test-04.tmp
> CtxTools | not removed : test-04.tuo
> CtxTools | removed files : 4
> CtxTools | kept files : 1
> CtxTools | persistent files : 0
> CtxTools | reclaimed bytes : 23960
>
>
> Shouldn't both the commands be equivalent. As a consequence of this, 
> texexec --purge does not delete temp files. I get
>
> CtxTools | purging temporary files : test-04.tex
> CtxTools | checking files that match 'test-04.tex-*.*'
> CtxTools | checking files that match 'test-04.tex.*'
> CtxTools | removed : mpgraph.mp
> CtxTools | removed files : 1
> CtxTools | kept files : 0
> CtxTools | persistent files : 0
> CtxTools | reclaimed bytes : 6
>
> Only mpgraph.mp is removed.
>   

you can play with this (nosuf):

at the top:

require 'base/file'

and in the purge method:

            report("purging#{if purgeall then ' all' end} temporary files : #{pattern.join(' ')}")
            pattern.each do |pat|
                nosuf = File.unsuffixed(pat)
                globbed = if recurse then "**/#{nosuf}-*.*" else "#{nosuf}-*.*" end
                report("checking files that match '#{globbed}'")
                files = Dir.glob(globbed)
                globbed = if recurse then "**/#{nosuf}.*" else "#{nosuf}.*" end
                report("checking files that match '#{globbed}'")
                files.push(Dir.glob(globbed))
            end


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list