Don't check whether an empty filename exists
ClosedPublic

Authored by elvisangelaccio on Nov 7 2017, 4:03 PM.

Details

Summary

Since 5.10 (commit 0dee566e98 in qtbase) Qt complains if we make a
system call with an empty filename (with a "Empty filename passed to
function" runtime warning).

There is no reason to call exists() if we already know that a filename
is empty. While at it, port to QFileInfo::exists() which is faster.

Test Plan

Together with D8696, fixes all the runtime warnings when running tests/kfilewidgettest_gui.

Diff Detail

Repository
R241 KIO
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
elvisangelaccio created this revision.Nov 7 2017, 4:03 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptNov 7 2017, 4:03 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript
dfaure accepted this revision.Nov 8 2017, 6:21 AM
This revision is now accepted and ready to land.Nov 8 2017, 6:21 AM
In D8697#165670, @apol wrote:

That would be much cleaner indeed, I'll hold this patch for now.

Personally, I don't find a check in QFile/QFileInfo "much cleaner". It's an invalid call, arguably. So checking here makes sense.

This revision was automatically updated to reflect the committed changes.