D17545: Do not stat move/copy job if the destination file system does not support writing

Shubham noreply at phabricator.kde.org
Thu Dec 13 14:51:47 GMT 2018


shubham added a comment.


    void JobTest::moveDirectoryToInaccessibleFilesystem()
    {
    #ifdef Q_OS_WIN
        QSKIP("Skipping unaccessible folder test on Windows, cannot remove all permissions from a folder");
    #endif
        // Given a directory that cannot be moved to destination beacause filesystem is write protected
        const QString src = homeTmpDir() + "srcdir";
        const QString dest = homeTmpDir() + "destdir";
        //QVERIFY(QDir().mkpath(src));
        QVERIFY(QFileInfo(src).isDir());
        QVERIFY(QFile(dest).setPermissions(QFile::Permissions())); // Make it inaccessible
    
        KIO::CopyJob *job = KIO::move(QUrl::fromLocalFile(src), QUrl::fromLocalFile(dest), KIO::HideProgressInfo);
        job->setUiDelegate(nullptr);
        job->setUiDelegateExtension(nullptr);
    
        // The job should fail with "access denied"
        QVERIFY(!job->exec());
        QCOMPARE(job->error(), (int)KIO::ERR_CANNOT_WRITE);
    
        QVERIFY(QFile::exists(dest));
    
        // Cleanup
        QVERIFY(!QFile::exists(src));
    }

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D17545

To: shubham, #frameworks, dfaure
Cc: davidedmundson, ngraham, broulik, kde-frameworks-devel, michaelh, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181213/4a00839e/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list