softwarecontainer  0.18.0-739e8d7 2017-05-04
softwarecontainer::RecursiveCopy Class Reference

The RecursiveCopy class is a singleton class used to copy files recursively from a source to a destination. More...

#include <recursivecopy.h>

Public Member Functions

 RecursiveCopy (RecursiveCopy &s)=delete
 Disallow copy and operator constructors. More...
 
void operator= (RecursiveCopy const &s)=delete
 
bool copy (std::string src, std::string dst)
 copy Copy files from src to dst More...
 

Static Public Member Functions

static RecursiveCopygetInstance ()
 getInstance Gets the RecursiveCopy instance. More...
 

Detailed Description

The RecursiveCopy class is a singleton class used to copy files recursively from a source to a destination.

Definition at line 29 of file recursivecopy.h.

Constructor & Destructor Documentation

softwarecontainer::RecursiveCopy::RecursiveCopy ( RecursiveCopy s)
delete

Disallow copy and operator constructors.

Member Function Documentation

RecursiveCopy & softwarecontainer::RecursiveCopy::getInstance ( )
static

getInstance Gets the RecursiveCopy instance.

Returns
The RecursiveCopy instance.

Definition at line 72 of file recursivecopy.cpp.

Referenced by softwarecontainer::OverlaySyncCleanupHandler::clean(), and softwarecontainer::FileToolkitWithUndo::syncOverlayMount().

73 {
74  static RecursiveCopy instance;
75  return instance;
76 }
RecursiveCopy(RecursiveCopy &s)=delete
Disallow copy and operator constructors.

Here is the caller graph for this function:

bool softwarecontainer::RecursiveCopy::copy ( std::string  src,
std::string  dst 
)

copy Copy files from src to dst

The function is protected by a mutex because it uses some non thread-safe C functions.

Parameters
srcThe source path to copy from
dstThe destination path to copy to
Returns
true on success
false on failure

Definition at line 78 of file recursivecopy.cpp.

Referenced by softwarecontainer::OverlaySyncCleanupHandler::clean(), and softwarecontainer::FileToolkitWithUndo::syncOverlayMount().

79 {
80  bool retval = true;
81  m_copyLock.lock();
82  dstRoot.assign(dst);
83  srcRoot.assign(src);
84  if (ftw(src.c_str(), copyFile, 20) != 0) {
85  log_error() << "Failed to recursively copy " << src << " to " << dst;
86  retval = false;
87  }
88  m_copyLock.unlock();
89 
90  return retval;
91 }

Here is the caller graph for this function:


The documentation for this class was generated from the following files: