• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5273: DOC_wv.pm: Remove rm -f

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension SearchEngineKinoSearchAddOn Enhancement Closed   major  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

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

ItemTemplate
Summary DOC_wv.pm: Remove rm -f
ReportedBy TWiki:Main.MarkusHesse
Codebase

SVN Range TWiki-4.3.0, Tue, 15 Jan 2008, build 16238
AppliesTo Extension
Component SearchEngineKinoSearchAddOn
Priority Enhancement
CurrentState Closed
WaitingFor

Checkins TWikirev:16703
TargetRelease major
ReleasedIn

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2008-04-20 - MarkusHesse
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback