file.cpp
changeset 508 ed8f21a839d7
parent 428 9ae68208e2ff
child 521 27cb122a88a6
     1.1 --- a/file.cpp	Mon Feb 19 12:01:52 2007 +0000
     1.2 +++ b/file.cpp	Mon Jun 18 15:10:19 2007 +0000
     1.3 @@ -126,6 +126,51 @@
     1.4  		qWarning ("removeDir("+d.path()+") failed!");
     1.5  }		
     1.6  
     1.7 +void copyDir (QDir src, QDir dst)
     1.8 +{
     1.9 +	system ("cp -r "+src.path()+"/* "+dst.path());
    1.10 +
    1.11 +	/*
    1.12 +	ErrorCode err=success;
    1.13 +
    1.14 +	Process *cpProc=new Process ();
    1.15 +	QStringList args;
    1.16 +	cpProc->setWorkingDirectory (src.path());
    1.17 +	args <<"-r";
    1.18 +	args <<src.path();
    1.19 +	args <<dst.path();
    1.20 +
    1.21 +	cpProc->start ("cp",args);
    1.22 +	if (!cpProc->waitForStarted() )
    1.23 +	{	
    1.24 +		// zip could not be started
    1.25 +		QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
    1.26 +					   QObject::tr("Couldn't start zip to compress data."));
    1.27 +		err=aborted;
    1.28 +	} else
    1.29 +	{
    1.30 +		// zip could be started
    1.31 +		cpProc->waitForFinished();
    1.32 +		if (cpProc->exitStatus()!=QProcess::NormalExit )
    1.33 +		{
    1.34 +			QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
    1.35 +						   QObject::tr("cp didn't exit normally")+
    1.36 +						   "\n" + cpProc->getErrout());
    1.37 +			err=aborted;
    1.38 +		} else
    1.39 +		{
    1.40 +			if (cpProc->exitCode()>0)
    1.41 +			{
    1.42 +				QMessageBox::critical( 0, QObject::tr( "Critical Error" ),
    1.43 +						   QString("cp exit code:  %1").arg(cpProc->exitCode() )+
    1.44 +						   "\n" + cpProc->getErrout() );
    1.45 +				err=aborted;
    1.46 +			}
    1.47 +		}
    1.48 +	}	// cp could be started
    1.49 +	*/
    1.50 +}
    1.51 +
    1.52  void makeSubDirs (const QString &s)
    1.53  {
    1.54  	QDir d(s);