summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9tools.cpp
blob: 1dd18f867cf9e3d4abf242b59174c4747ba75bd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// C++ Implementation: k9tools
//
// Description: 
//
//
// Author: Jean-Michel PETIT <k9copy@free.fr>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "k9tools.h"
#include <kstandarddirs.h>
#include <tqdir.h>

bool k9Tools::checkProgram(TQString _progName) {
   return TDEStandardDirs::findExe( _progName,NULL,false) !=NULL ;
}

void k9Tools::clearOutput(TQString name) {
    TQDir dir(name);
    //delete files in directory
    TQStringList lst = dir.entryList( "*",TQDir::Files |TQDir::Hidden );
    for ( TQStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
        //TQString c(( *it ).latin1() );
        dir.remove (*it);
    }
    //scanning subdir
    TQStringList lstdir = dir.entryList( "*",TQDir::Dirs );
    for ( TQStringList::Iterator it = lstdir.begin(); it != lstdir.end(); ++it ) {
        TQString c=*it;
        if ((c!=".") && c!="..") {
            clearOutput(dir.absFilePath(c));
            dir.rmdir(c);
        }
    }

}