コード例 #1
0
const CLuaArguments& CLuaArguments::operator = ( const CLuaArguments& Arguments )
{
    CopyRecursive ( Arguments );

    // Return the given reference allowing for chaining
    return Arguments;
}
コード例 #2
0
ファイル: utilities.cpp プロジェクト: Gu1/Clementine
bool CopyRecursive(const QString& source, const QString& destination) {
  // Make the destination directory
  QString dir_name = source.section('/', -1, -1);
  QString dest_path = destination + "/" + dir_name;
  QDir().mkpath(dest_path);

  QDir dir(source);
  for (const QString& child :
       dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs)) {
    if (!CopyRecursive(source + "/" + child, dest_path)) {
      qLog(Warning) << "Failed to copy dir" << source + "/" + child << "to"
                    << dest_path;
      return false;
    }
  }

  for (const QString& child :
       dir.entryList(QDir::NoDotAndDotDot | QDir::Files)) {
    if (!QFile::copy(source + "/" + child, dest_path + "/" + child)) {
      qLog(Warning) << "Failed to copy file" << source + "/" + child << "to"
                    << dest_path;
      return false;
    }
  }
  return true;
}
コード例 #3
0
ファイル: file_utils_win32.cpp プロジェクト: maccman/kroll
	// TODO: implement this for other platforms
	void FileUtils::CopyRecursive(std::string &dir, std::string &dest, std::string exclude)
	{ 
		if (!IsDirectory(dest)) 
		{
			CreateDirectory(dest);
		}

#ifdef DEBUG
std::cout << "\n>Recursive copy " << dir << " to " << dest << std::endl;
#endif
		std::vector<std::string> files;
		ListDir(dir, files);
		for (size_t i = 0; i < files.size(); i++)
		{
			std::string& filename = files[i];
			if (!exclude.empty() && exclude == filename)
				continue;

			std::string srcName = Join(dir.c_str(), filename.c_str(), NULL);
			std::string destName = Join(dest.c_str(), filename.c_str(), NULL);

			if (IsDirectory(srcName))
			{
#ifdef DEBUG
				std::cout << "create dir: " << destName << std::endl;
#endif
				CreateDirectory(destName);
				CopyRecursive(srcName, destName);
			}
			else
			{
				std::wstring wideSrcName = UTILS_NS::UTF8ToWide(srcName);
				std::wstring wideDestName = UTILS_NS::UTF8ToWide(destName);
				CopyFileW(wideSrcName.c_str(), wideDestName.c_str(), FALSE);
			}
		}
	}
コード例 #4
0
CLuaArguments::CLuaArguments ( const CLuaArguments& Arguments, std::map < CLuaArguments*, CLuaArguments* > * pKnownTables )
{
    // Copy all the arguments
    CopyRecursive ( Arguments, pKnownTables );
}