Bug 355594 - Create new folder with existent name does nothing
Summary: Create new folder with existent name does nothing
Status: RESOLVED DUPLICATE of bug 400423
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-19 16:03 UTC by Gregor Mi
Modified: 2019-01-09 18:12 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregor Mi 2015-11-19 16:03:17 UTC
1) Create New... Folder
2) Enter a name of a folder which already exists
3) OK

ACTUAL: nothing happens

EXPECTED: some notification that the folder already exists.
Comment 1 Emmanuel Pescosta 2015-11-19 16:17:21 UTC
Thanks for the bug report!
Looks like the problem is in MkpathJob::slotResult which is in KIO, but I have no time to test it atm.

if (job->error() && job->error() != KIO::ERR_DIR_ALREADY_EXIST) {
        KIO::Job::slotResult(job); // will set the error and emit result(this)
        return;
    }

The "job->error() != KIO::ERR_DIR_ALREADY_EXIST" check looks strange?!
Comment 2 David Faure 2015-11-19 17:35:17 UTC
That's the intended behavior for MkpathJob, which is the network-transparent version of QDir::mkpath() or `mkdir -p`. It's used by programs to ensure that a given directory exists. If it already exists, everything's ok.

Maybe dolphin should use KIO::mkdir rather than KIO::mkpath?
Comment 3 Emmanuel Pescosta 2015-11-19 17:48:44 UTC
(In reply to David Faure from comment #2)
> That's the intended behavior for MkpathJob, which is the network-transparent
> version of QDir::mkpath() or `mkdir -p`. It's used by programs to ensure
> that a given directory exists. If it already exists, everything's ok.

Thanks for the info, didn't know that :)

> Maybe dolphin should use KIO::mkdir rather than KIO::mkpath?

Ok then we have to change it in KNewFileMenuPrivate::_k_slotCreateDirectory (uses KIO::mkpath atm)
Comment 4 David Faure 2015-11-21 13:02:22 UTC
On second thought I assume the use of mkpath was to make it possible to create folder/subfolder/ in one go. In that case, the code would have to use KIO::stat first, to error if it already exists, and then mkpath (from the slot connected to KIO::stat).
Comment 5 Shubham 2019-01-09 18:00:20 UTC
https://phabricator.kde.org/D17617
Comment 6 Nate Graham 2019-01-09 18:12:22 UTC

*** This bug has been marked as a duplicate of bug 400423 ***