Windows: Work around path returned by QUrl
AbandonedPublic

Authored by mreeves on Feb 20 2019, 6:28 PM.

Details

Reviewers
ptekchand
Summary

Built with: craft kdiff3
With ABI = windows-msvc2017_64-cl
On Windows:
The leading "/" in the path via QUrl::fromLocalFile causes some
issues.

More details including callstacks and inline links to sources describing where certain transformations happen to introduce issues are described in https://github.com/KDE/kdiff3/pull/1

Test Plan

Repro:
Build and launch kdiff3 on Windows
Paste in two input files in the popped up input dialog for "A (BASE)" and "B"
Click OK to start the diff.
Without this patch, a "File open error" dialog pops up with "Opening of these files failed:" and the two source paths that were typed in.

Apply the patch, repeat the repro steps and notice that the files can be diffed successfully.

Diff Detail

Repository
R983 KDiff3
Lint
Lint Skipped
Unit
Unit Tests Skipped
ptekchand requested review of this revision.Feb 20 2019, 6:28 PM
ptekchand created this revision.
pino added a subscriber: pino.Feb 20 2019, 8:27 PM

Usually, if a url refers to local file (so isLocalFile() return true), then the right fix to get its local path is to use toLocalFile() instead of path().
Can you please try that change unconditionally?

mreeves added a comment.EditedFeb 20 2019, 11:12 PM

I will switch to toLocalFile in any case as it is more correctly what I am
trying to accomplish here. Some how I missed that function. I definitely
prefer a non os specific fix if QTs API allows it. Let me know.

Update:

QUrl::path has been now been replaced with toLocalFile where appropriate.

The issue of bad paths appears to be fixed with change to QURrl::toLocalFile.

mreeves commandeered this revision.Apr 19 2019, 9:03 PM
mreeves abandoned this revision.
mreeves edited reviewers, added: ptekchand; removed: mreeves.

Closing stale revision. I believing the reported problem to be fixed.