コード例 #1
0
	TEST_F(FSTestFixture, copyFolder_string_rec)
	{
		// here we copy a directory with files into a directory ...
		copyFolder(SRC.string(), (SRC5 / "0").string());

		ASSERT_TRUE(!fs::exists(DES5));
		// ... so we can copy the directory with the directory with files ;)
		copyFolder(SRC5.string(), DES5.string());
		ASSERT_TRUE(fs::exists(DES5));
		ASSERT_TRUE(fs::exists(DES5 / "0"));
		ASSERT_EQ_FILES(SRC / "0", DES5 / "0" / "0");
		ASSERT_EQ_FILES(SRC / "1.txt", DES5 / "0" / "1.txt");
		ASSERT_EQ_FILES(SRC / "2.png", DES5 / "0" / "2.png");
		ASSERT_EQ_FILES(SRC / UNICODE_EXAMPLE_FILE, DES5 / "0" / UNICODE_EXAMPLE_FILE);
	}
コード例 #2
0
ファイル: funcoes.cpp プロジェクト: escrifonife1/Almoco
void Funcoes::copyFolder(QString sourceFolder, QString destFolder)
{
    QDir sourceDir(sourceFolder);
    if(!sourceDir.exists())
        return;
    QDir destDir(destFolder);
    if(!destDir.exists())
    {
        destDir.mkdir(destFolder);
    }
    QStringList files = sourceDir.entryList(QDir::Files);
    for(int i = 0; i< files.count(); i++)
    {
        QString srcName = sourceFolder + "/" + files[i];
        QString destName = destFolder + "/" + files[i];
        QFile::copy(srcName, destName);
    }
    files.clear();
    files = sourceDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
    for(int i = 0; i< files.count(); i++)
    {
        QString srcName = sourceFolder + "/" + files[i];
        QString destName = destFolder + "/" + files[i];
        copyFolder(srcName, destName);
    }
}
コード例 #3
0
ファイル: filemanager.cpp プロジェクト: newdebug/NewDebug
void FileManager::run()
{
    qDebug() << "run the thread to copy file...";

    if( isPath( srcfileName) )
    {
        //qDebug() << srcfileName << destinationPath;
        copyFolder(srcfileName, destinationPath);
    }
    else
    {
        copyFile(srcfileName, destinationPath);
    }

    qDebug() << "copy done!";

//    fileSize = src.size();
//    int oldPercent = 0;
//    for(qint64 index = 0; index < fileSize; ++index)
//    {
//        dst.write(src.read(index));
//        src.seek(index);
//        dst.seek(index);

//        int percent = ((index + 1) * 100) / fileSize;
//        if (oldPercent != percent)
//        {
//            emit verificationProgressSignal(percent);
//            oldPercent = percent;
//        }
//    }
    //emit verificationDone();
}
コード例 #4
0
	TEST_F(FSTestFixture, copyFolder_string_NULL_default)
	{
		ASSERT_TRUE(!fs::exists(DES3));
		copyFolder(SRC.string(), DES3.string());
		ASSERT_TRUE(fs::exists(DES3));
		ASSERT_EQ_FILES(SRC / "0", DES3 / "0");
		ASSERT_EQ_FILES(SRC / "1.txt", DES3 / "1.txt");
		ASSERT_EQ_FILES(SRC / "2.png", DES3 / "2.png");
		ASSERT_EQ_FILES(SRC / UNICODE_EXAMPLE_FILE, DES3 / UNICODE_EXAMPLE_FILE);
	}
コード例 #5
0
	TEST_F(FSTestFixture, copyFolder_string_vector_default)
	{
		std::vector<std::string> ignoreList;
		ignoreList.push_back("1.txt");

		ASSERT_TRUE(!fs::exists(DES4));
		copyFolder(SRC.string(), DES4.string(), &ignoreList);
		ASSERT_TRUE(fs::exists(DES4));
		ASSERT_EQ_FILES(SRC / "0", DES4 / "0");
		ASSERT_TRUE(!fs::exists(DES4 / "1.txt"));
		ASSERT_EQ_FILES(SRC / "2.png", DES4 / "2.png");
		ASSERT_EQ_FILES(SRC / UNICODE_EXAMPLE_FILE, DES4 / UNICODE_EXAMPLE_FILE);
	}
コード例 #6
0
	TEST_F(FSTestFixture, copyFolder_Path_NULL_default)
	{
		Path src(SRC.string(), "", false);
		Path des(DES1.string(), "", false);

		ASSERT_TRUE(!fs::exists(DES1));
		copyFolder(src, des);
		ASSERT_TRUE(fs::exists(DES1));
		ASSERT_EQ_FILES(SRC / "0", DES1 / "0");
		ASSERT_EQ_FILES(SRC / "1.txt", DES1 / "1.txt");
		ASSERT_EQ_FILES(SRC / "2.png", DES1 / "2.png");
		ASSERT_EQ_FILES(SRC / UNICODE_EXAMPLE_FILE, DES1 / UNICODE_EXAMPLE_FILE);
	}
コード例 #7
0
	TEST_F(FSTestFixture, copyFolder_Path_vector_default)
	{
		Path src(SRC.string(), "", false);
		Path des(DES2.string(), "", false);
		std::vector<std::string> ignoreList;
		ignoreList.push_back("1.txt");

		ASSERT_TRUE(!fs::exists(DES2));
		copyFolder(src, des, &ignoreList);
		ASSERT_TRUE(fs::exists(DES2));
		ASSERT_EQ_FILES(SRC / "0", DES2 / "0");
		ASSERT_TRUE(!fs::exists(DES2 / "1.txt"));
		ASSERT_EQ_FILES(SRC / "2.png", DES2 / "2.png");
		ASSERT_EQ_FILES(SRC / UNICODE_EXAMPLE_FILE, DES2 / UNICODE_EXAMPLE_FILE);
	}
コード例 #8
0
ファイル: RhoFile.cpp プロジェクト: 4nkh/rhodes
static unsigned int copyFolder(const StringW& strSrc, const StringW& strDst, boolean bMove)
{
    unsigned int nErr = 0;

    CRhoFile::createFolder(convertToStringA(strDst).c_str());

    StringW wFolderMask = CFilePath::join(strSrc, L"*");

    WIN32_FIND_DATAW FindFileData = {0};
    HANDLE hFind = INVALID_HANDLE_VALUE;

#if defined(OS_WP8)
	hFind = FindFirstFileExW(wFolderMask.c_str(), FindExInfoStandard,  &FindFileData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_CASE_SENSITIVE);
#else
    hFind = FindFirstFileW(wFolderMask.c_str(), &FindFileData);
#endif

    if (hFind == INVALID_HANDLE_VALUE) 
        return GetLastError();

    do{
        if (!wcscmp(FindFileData.cFileName , L".")) continue ;
		if (!wcscmp(FindFileData.cFileName , L"..")) continue ;

        if ( FindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY )
        {
            int i = 0;
            nErr = copyFolder( CFilePath::join(strSrc,FindFileData.cFileName), CFilePath::join(strDst,FindFileData.cFileName), bMove );
        }
        else
        {
            if ( bMove )
            {
                CRhoFile::deleteFile(convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str());
                nErr = CRhoFile::renameFile(convertToStringA(CFilePath::join(strSrc,FindFileData.cFileName)).c_str(), convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str());
            }
            else
                nErr = CRhoFile::copyFile( convertToStringA(CFilePath::join(strSrc,FindFileData.cFileName)).c_str(), convertToStringA(CFilePath::join(strDst,FindFileData.cFileName)).c_str() );
        }

        if ( nErr != 0 )
            return nErr;
    }while (FindNextFileW(hFind, &FindFileData) != 0); 

    FindClose(hFind);

    return 0;
}
コード例 #9
0
bool FileSystemManager::copyFolder(QString source, QString target, qint64 total, bool cut)
{
    QDir sourceFolder(source);
    QDir targetFolder(QFileInfo(target).path());
    QString folderName = QFileInfo(target).fileName();

    bool ok = true;

    if(!QFileInfo(target).exists())
        targetFolder.mkdir(folderName);

    targetFolder = QDir(target);

    QStringList files = sourceFolder.entryList(QDir::Files
                                               | QDir::NoDotAndDotDot | QDir::Hidden);

    for(int i = 0; i < files.count(); i++)
    {
        QString srcName = sourceFolder.path() + "/" + files[i];
        QString destName = targetFolder.path() + "/" + files[i];
        if(!copyFile(srcName, destName, total, cut))
            ok = false;     //don't remove source folder if all files not cut

        if(m_cancel == true)
            return false;                           //cancelled
    }

    files.clear();
    files = sourceFolder.entryList(QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Hidden);

    for(int i = 0; i < files.count(); i++)
    {
        if(m_cancel)
            return false;    //cancelled

        QString srcName = sourceFolder.path() + "/" + files[i];
        QString destName = targetFolder.path() + "/" + files[i];
        copyFolder(srcName, destName, total, cut);
    }

    //remove source folder if all files moved ok
    if(cut && ok)
        sourceFolder.rmdir(source);
    return ok;
}
コード例 #10
0
ファイル: RhoFile.cpp プロジェクト: KlearXos/rhodes
/*static*/ unsigned int CRhoFile::moveFoldersContentToAnotherFolder(const char* szSrcFolderPath, const char* szDstFolderPath) 
{
#if defined(WINDOWS_PLATFORM)

    StringW strSrcW, strDstW;
    common::convertToStringW(szSrcFolderPath,strSrcW);
    common::convertToStringW(szDstFolderPath,strDstW);
    String_replace(strSrcW, L'/', L'\\' );
    String_replace(strDstW, L'/', L'\\' );

    return copyFolder(strSrcW, strDstW, true);
#elif defined (OS_ANDROID)

    return iterateFolderTree(String(szSrcFolderPath), MoveFileFunctor(szSrcFolderPath, szDstFolderPath));

#else
    rho_file_impl_move_folders_content_to_another_folder(szSrcFolderPath, szDstFolderPath);
    return 0;
#endif
}
コード例 #11
0
ファイル: tcpclient.c プロジェクト: jwchan1992/Pheonix2
main(int argc, char * argv[])
{
	int sockfd;
	char buffer[BUFSIZE+1];
	char x [BUFSIZE+1];
	struct sockaddr_in serv_addr;

if(argc <=1)
{
	printf("How to use: %s remoteIPaddress [example./ client 127.0.0.1]\n", argv[0]);
	exit(1);
}
bzero((char *) &serv_addr, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons (SERV_TCP_PORT);
inet_pton (AF_INET, argv[1], &serv_addr.sin_addr);

if((sockfd= socket(AF_INET, SOCK_STREAM,0))<0)
{
	perror("Client: socket() error\n");
	exit(1);
}

if(connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))<0){
perror("Client: connect() error\n");
exit(1);
}
int count=0;
while(count==0)
{
	
	printf("\n[ 1.Send file. 2.Download 3.delete file 4.create folder 5.delete folder 6.copy folder 7. exit]\n");
	fgets(buffer,1024,stdin);
	send (sockfd, buffer, BUFSIZE,0);
	int choose;
	choose = atoi(buffer);
	
if(choose == 1){
	/* Send File to Server */
        
	printf("[Client] Select the File you which to send to your directory.\n 1.aaa.txt  2.bbb.txt   3.ccc.txt\n");
	fgets(buffer,1024,stdin);
	send (sockfd, buffer, BUFSIZE,0);
	int option;
	option = atoi(buffer);
	if(option==1)
	{		
		char* fs_name ="/home/junjeck/client/aaa.txt";
        	char sdbuf[BUFSIZE]; 
		printf("[Client] Sending aaa.txt to the Server... \n");
		FILE *fs = fopen(fs_name, "r");
		bzero(sdbuf, BUFSIZE); 
        	int fs_block_sz; 
        	while((fs_block_sz = fread(sdbuf, sizeof(char), BUFSIZE, fs)) > 0)
        	{
            		if(send(sockfd, sdbuf, fs_block_sz, 0) < 0)
           		 {
                		fprintf(stderr, "ERROR: Failed to send file aaa.txt. (errno = )\n");
               			exit(1);
           		 }
            		bzero(sdbuf, BUFSIZE);
       		 }
		printf("[Client] Sending aaa.txt to the Server... \n");
        	printf("Ok File aaa.txt from Client was Sent!\n File are saved in Server\n");
		fclose(fs); 
		count=0;
	}//end option 1
	else if(option==2)
	{
		char* fs_name ="/home/junjeck/client/bbb.txt";
        	char sdbuf[BUFSIZE]; 
		printf("[Client] Sending aaa.txt to the Server... \n");
		FILE *fs = fopen(fs_name, "r");
		bzero(sdbuf, BUFSIZE); 
        	int fs_block_sz; 
        	while((fs_block_sz = fread(sdbuf, sizeof(char), BUFSIZE, fs)) > 0)
        	{
            		if(send(sockfd, sdbuf, fs_block_sz, 0) < 0)
           		 {
                		fprintf(stderr, "ERROR: Failed to send file aaa.txt. (errno = )\n");
               			exit(1);
           		 }
            		bzero(sdbuf, BUFSIZE);
       		 }
		printf("[Client] Sending bbb.txt to the Server... \n");
        	printf("Ok File bbb.txt from Client was Sent!\n File are saved in Server\n");
		fclose(fs); 
		count=0;
	}//end option 2
	else if(option==3)
	{
		char* fs_name ="/home/junjeck/client/ccc.txt";
        	char sdbuf[BUFSIZE]; 
		printf("[Client] Sending aaa.txt to the Server... \n");
		FILE *fs = fopen(fs_name, "r");
		bzero(sdbuf, BUFSIZE); 
        	int fs_block_sz; 
        	while((fs_block_sz = fread(sdbuf, sizeof(char), BUFSIZE, fs)) > 0)
        	{
            		if(send(sockfd, sdbuf, fs_block_sz, 0) < 0)
           		 {
                		fprintf(stderr, "ERROR: Failed to send file aaa.txt. (errno = )\n");
               			exit(1);
           		 }
            		bzero(sdbuf, BUFSIZE);
       		 }
		printf("[Client] Sending ccc.txt to the Server... \n");
        	printf("Ok File ccc.txt from Client was Sent!\n File are saved in Server\n");
		fclose(fs); 
		count=0;
	}//end option 3
	
	//fs_name =strtok(buffer,"");

	//char* name = malloc(strlen(fs_name)+strlen(filename) + 2);
    	//sprintf(name,"%s%s", fs_name, filename);
	count=0;
}//end  choose 1

else if (choose == 2)
{
	 /*Receive File from Server */
        
	printf("Please select the File need to Dowload.\n1.chan 2.jun\n");
	fgets(buffer,1024,stdin);
	send(sockfd, buffer, BUFSIZE,0);
	int option2;
	option2=atoi(buffer);
	//printf("Please Write the Filename to Store File:\n");
	//gets(buffer);
	//char* name = malloc(strlen(fr_name)+strlen(buffer) + 2);
    	//sprintf(name,"%s%s", fr_name, buffer);
        if(option2==1)
	{
		char* fr_name = "/home/junjeck/client/chan.txt";
		FILE *fr = fopen(fr_name, "a");
		if(fr == NULL)
		{
			//strcpy(buffer, "0");
			//send(new_sockfd, buffer, BUFSIZE, 0);
            		printf("File chan.txt Cannot be opened file on server.\n");
			return (0);
		}
		
	    bzero(buffer, BUFSIZE); 
            int fr_block_sz = 0;
            while((fr_block_sz = recv(sockfd, buffer, BUFSIZE, 0)) > 0) 
            {
                int write_sz = fwrite(buffer, sizeof(char), fr_block_sz, fr);
                if(write_sz < fr_block_sz)
                {
                    error("File write failed on server.\n");
                }
                bzero(buffer, BUFSIZE);
                if (fr_block_sz == 0 || fr_block_sz != 512) 
                {
                    break;
                }
            }
            if(fr_block_sz < 0)
            {
                if (errno == EAGAIN)
                {
                    printf("recv() timed out.\n");
                }
                else
                {
                    fprintf(stderr, "recv() failed due to errno = %d\n", errno);
                    exit(1);
                }
            }
            printf("Ok Received from Server!! File are stored in Folder clientFile!!\n");
            fclose(fr); 
	count=0;
	}//end option1
	else if(option2==2)
	{
		char* fr_name = "/home/junjeck/client/jun.txt";
		FILE *fr = fopen(fr_name, "a");
		if(fr == NULL)
		{
			//strcpy(buffer, "0");
			//send(new_sockfd, buffer, BUFSIZE, 0);
            		printf("File %s Cannot be opened file on server.\n", fr_name);
			return (0);
		}
		
	    bzero(buffer, BUFSIZE); 
            int fr_block_sz = 0;
            while((fr_block_sz = recv(sockfd, buffer, BUFSIZE, 0)) > 0) 
            {
                int write_sz = fwrite(buffer, sizeof(char), fr_block_sz, fr);
                if(write_sz < fr_block_sz)
                {
                    error("File write failed on server.\n");
                }
                bzero(buffer, BUFSIZE);
                if (fr_block_sz == 0 || fr_block_sz != 512) 
                {
                    break;
                }
            }
            if(fr_block_sz < 0)
            {
                if (errno == EAGAIN)
                {
                    printf("recv() timed out.\n");
                }
                else
                {
                    fprintf(stderr, "recv() failed due to errno = %d\n", errno);
                    exit(1);
                }
            }
            printf("Ok Received from Server!! File are stored in Folder clientFile!!\n");
            fclose(fr); 
		count=0;
	}//end option2

	count=0;
}//end if choose 2
else if(choose == 3)
{
	deleteFile(sockfd);	
	count = 0;
}else if(choose == 4)
{
	createFolder(sockfd);
	count=0;
}
else if(choose == 5)
{
	deleteFolder(sockfd);
	count=0;
}
else if(choose==6)
{
	copyFolder(sockfd);
	count=0;
}
else if(choose == 7){
	count=1;
}	
else
{
	printf("Make Sure You are Enter Valid Number");
	count=0;
	//recv(sockfd, buffer, BUFSIZE,0);//receive meassage from server
	//printf("Message received from server: %s\n", buffer);
}

}//while (strlen(buffer)!=2 && buffer[0]!='q');
close (sockfd);

}
コード例 #12
0
ファイル: packagejobthread.cpp プロジェクト: KDE/kpackage
bool PackageJobThread::installPackage(const QString &src, const QString &dest, OperationType operation)
{
    QDir root(dest);
    if (!root.exists()) {
        QDir().mkpath(dest);
        if (!root.exists()) {
            d->errorMessage = i18n("Could not create package root directory: %1", dest);
            d->errorCode = Package::JobError::RootCreationError;
            //qWarning() << "Could not create package root directory: " << dest;
            return false;
        }
    }

    QFileInfo fileInfo(src);
    if (!fileInfo.exists()) {
        d->errorMessage = i18n("No such file: %1", src);
        d->errorCode = Package::JobError::PackageFileNotFoundError;
        return false;
    }

    QString path;
    QTemporaryDir tempdir;
    bool archivedPackage = false;

    if (fileInfo.isDir()) {
        // we have a directory, so let's just install what is in there
        path = src;
        // make sure we end in a slash!
        if (!path.endsWith('/')) {
            path.append('/');
        }
    } else {
        KArchive *archive = 0;
        QMimeDatabase db;
        QMimeType mimetype = db.mimeTypeForFile(src);
        if (mimetype.inherits(QStringLiteral("application/zip"))) {
            archive = new KZip(src);
        } else if (mimetype.inherits(QStringLiteral("application/x-compressed-tar")) ||
                   mimetype.inherits(QStringLiteral("application/x-tar")) ||
                   mimetype.inherits(QStringLiteral("application/x-bzip-compressed-tar")) ||
                   mimetype.inherits(QStringLiteral("application/x-xz")) ||
                   mimetype.inherits(QStringLiteral("application/x-lzma"))) {
            archive = new KTar(src);
        } else {
            //qWarning() << "Could not open package file, unsupported archive format:" << src << mimetype.name();
            d->errorMessage = i18n("Could not open package file, unsupported archive format: %1 %2", src, mimetype.name());
            d->errorCode = Package::JobError::UnsupportedArchiveFormatError;
            return false;
        }

        if (!archive->open(QIODevice::ReadOnly)) {
            //qWarning() << "Could not open package file:" << src;
            delete archive;
            d->errorMessage = i18n("Could not open package file: %1", src);
            d->errorCode = Package::JobError::PackageOpenError;
            return false;
        }

        archivedPackage = true;
        path = tempdir.path() + '/';

        d->installPath = path;

        const KArchiveDirectory *source = archive->directory();
        source->copyTo(path);

        QStringList entries = source->entries();
        if (entries.count() == 1) {
            const KArchiveEntry *entry = source->entry(entries[0]);
            if (entry->isDirectory()) {
                path.append(entry->name()).append("/");
            }
        }

        delete archive;
    }

    QDir packageDir(path);
    QFileInfoList entries = packageDir.entryInfoList(*metaDataFiles);
    KPluginMetaData meta;
    if (!entries.isEmpty()) {
        const QString metadataFilePath = entries.first().filePath();
        if (metadataFilePath.endsWith(QLatin1String(".desktop")))
            meta = KPluginMetaData(metadataFilePath);
        else {
            QFile f(metadataFilePath);
            if(!f.open(QIODevice::ReadOnly)){
                qWarning() << "Couldn't open metadata file" << src << path;
                d->errorMessage = i18n("Could not open metadata file: %1", src);
                d->errorCode = Package::JobError::MetadataFileMissingError;
                return false;
            }
            QJsonObject metadataObject = QJsonDocument::fromJson(f.readAll()).object();
            meta = KPluginMetaData(metadataObject, QString(), metadataFilePath);
        }
    }

    if (!meta.isValid()) {
        qDebug() << "No metadata file in package" << src << path;
        d->errorMessage = i18n("No metadata file in package: %1", src);
        d->errorCode = Package::JobError::MetadataFileMissingError;
        return false;
    }


    QString pluginName = meta.pluginId();
    qDebug() << "pluginname: " << meta.pluginId();
    if (pluginName.isEmpty()) {
        //qWarning() << "Package plugin name not specified";
        d->errorMessage = i18n("Package plugin name not specified: %1", src);
        d->errorCode = Package::JobError::PluginNameMissingError;
        return false;
    }

    // Ensure that package names are safe so package uninstall can't inject
    // bad characters into the paths used for removal.
    QRegExp validatePluginName("^[\\w-\\.]+$"); // Only allow letters, numbers, underscore and period.
    if (!validatePluginName.exactMatch(pluginName)) {
        //qDebug() << "Package plugin name " << pluginName << "contains invalid characters";
        d->errorMessage = i18n("Package plugin name %1 contains invalid characters", pluginName);
        d->errorCode = Package::JobError::PluginNameInvalidError;
        return false;
    }

    QString targetName = dest;
    if (targetName[targetName.size() - 1] != '/') {
        targetName.append('/');
    }
    targetName.append(pluginName);

    if (QFile::exists(targetName)) {
        if (operation == Update) {
            KPluginMetaData oldMeta(targetName + QLatin1String("/metadata.desktop"));

            if (oldMeta.serviceTypes() != meta.serviceTypes()) {
                d->errorMessage = i18n("The new package has a different type from the old version already installed.", meta.version(), meta.pluginId(), oldMeta.version());
                d->errorCode = Package::JobError::UpdatePackageTypeMismatchError;
            } else if (isVersionNewer(oldMeta.version(), meta.version())) {
                const bool ok = uninstallPackage(targetName);
                if (!ok) {
                    d->errorMessage = i18n("Impossible to remove the old installation of %1 located at %2. error: %3", pluginName, targetName, d->errorMessage);
                    d->errorCode = Package::JobError::OldVersionRemovalError;
                }
            } else {
                d->errorMessage = i18n("Not installing version %1 of %2. Version %3 already installed.", meta.version(), meta.pluginId(), oldMeta.version());
                d->errorCode = Package::JobError::NewerVersionAlreadyInstalledError;
            }
        } else {
            d->errorMessage = i18n("%1 already exists", targetName);
            d->errorCode = Package::JobError::PackageAlreadyInstalledError;
        }

        if (d->errorCode != KJob::NoError) {
            d->installPath = targetName;
            return false;
        }
    }

    //install dependencies
    const QStringList dependencies = KPluginMetaData::readStringList(meta.rawData(), QStringLiteral("X-KPackage-Dependencies"));
    for(const QString &dep : dependencies) {
        QUrl depUrl(dep);
        if (!installDependency(depUrl)) {
            d->errorMessage = i18n("Could not install dependency: %1", dep);
            d->errorCode = Package::JobError::PackageCopyError;
            return false;
        }
    }

    if (archivedPackage) {
        // it's in a temp dir, so just move it over.
        const bool ok = copyFolder(path, targetName);
        removeFolder(path);
        if (!ok) {
            //qWarning() << "Could not move package to destination:" << targetName;
            d->errorMessage = i18n("Could not move package to destination: %1", targetName);
            d->errorCode = Package::JobError::PackageMoveError;
            return false;
        }
    } else {
        // it's a directory containing the stuff, so copy the contents rather
        // than move them
        const bool ok = copyFolder(path, targetName);
        if (!ok) {
            //qWarning() << "Could not copy package to destination:" << targetName;
            d->errorMessage = i18n("Could not copy package to destination: %1", targetName);
            d->errorCode = Package::JobError::PackageCopyError;
            return false;
        }
    }

    if (archivedPackage) {
        // no need to remove the temp dir (which has been successfully moved if it's an archive)
        tempdir.setAutoRemove(false);
    }


    indexDirectory(dest, QStringLiteral("kpluginindex.json"));


    d->installPath = targetName;

    //qWarning() << "Not updating kbuildsycoca4, since that will go away. Do it yourself for now if needed.";
    return true;
}