DOC_wv.pm: I see some problems at the lines
$cmd = "rm -f " . $tmp_file . "*"; `$cmd`;
This will only work on Unix. On windows (without Cygwin) this will produce trouble.
--
TWiki:Main/MarkusHesse
- 19 Jan 2008
Markus, could this line be replaced by
TWiki::Store::RcsFile::_rmtree
?
--
TWiki:Main.GuilhermeGarnier
- 29 Jan 2008
Either you should use the official API (ie TWiki::Func) and in case it does not provide what you need, write some plain perl. Removing a file in perl should not be a big science. Using non API calls to the internals of TWiki very likely means that the plugin does not work in later versions of TWiki.
--
TWiki:Main.KennethLavrsen
- 29 Jan 2008
I agree with you, but I didn't find a function on the API to make a recursive directory removal.
I just wrote the following function to solve this problem. I didn't test it inside the plugin, just separately, but I don't think we'll have problems.
sub rmdirr {
my $dir = shift;
local *DIR;
opendir (DIR, $dir) || return 0;
while (my $file = readdir(DIR)) {
# Ignores . and ..
next if ($file =~ /^\.{1,2}$/);
$file = "$dir/$file";
if (-d $file) {
rmdirr($file);
} elsif (-f $file) {
unlink($file);
}
}
closedir DIR;
rmdir($dir);
return 1;
}
--
TWiki:Main.GuilhermeGarnier
- 01 Feb 2008