VFolder* VRIAServerSolution::RetainLogFolder( bool inCreateIfNotExists) const { VFolder *folder = NULL; if (fDesignSolution != NULL) { VProjectItem *item = fDesignSolution->GetSolutionFileProjectItem(); if (item != NULL) { VFilePath path; item->GetFilePath( path); path = path.ToFolder(); path.ToSubFolder( L"Logs"); folder = new VFolder( path); if (folder != NULL && !folder->Exists() && inCreateIfNotExists) folder->Create(); } } return folder; }
VError VFolder::CopyContentsTo( const VFolder& inDestinationFolder, FileCopyOptions inOptions) const { VError err = VE_OK; if (!inDestinationFolder.Exists()) { // this easy case should be handled by system implementation err = inDestinationFolder.Create(); } else if (IsSameFolder( &inDestinationFolder) || inDestinationFolder.GetPath().IsChildOf( GetPath())) { StThrowFileError errThrow( this, VE_CANNOT_COPY_ON_ITSELF); errThrow->SetString( "destination", inDestinationFolder.GetPath().GetPath()); err = errThrow.GetError(); } if (err == VE_OK) { bool ok = true; for( VFolderIterator folderIterator( this, FI_WANT_FOLDERS | FI_WANT_INVISIBLES) ; folderIterator.IsValid() && ok ; ++folderIterator) { VError err2 = folderIterator->CopyTo( inDestinationFolder, NULL, inOptions); if (err == VE_OK) err = err2; ok = (err == VE_OK) | ((inOptions & FCP_ContinueOnError) != 0); } for( VFileIterator fileIterator( this, FI_WANT_FILES | FI_WANT_INVISIBLES) ; fileIterator.IsValid() && ok ; ++fileIterator) { VError err2 = fileIterator->CopyTo( inDestinationFolder, NULL, inOptions); if (err == VE_OK) err = err2; ok = (err == VE_OK) | ((inOptions & FCP_ContinueOnError) != 0); } } return err; }