I get the file path from Qml like this:
mainView.projectFilePath = Qt.resolvedUrl(newProjectFileDlg.fileUrl).toString();
The above file path looks like this: file:///C:/uuuu.a3
But when this path is passed to QFile, it complains
The filename, directory name, or volume label syntax is incorrect
How to solve this problem?
QUrl( "file:///C:/myfile.txt" ).toLocalFile();
does the conversion to"C:/myfile.txt"
while fromLocalFile just seems to prepend"file:///"
. Also see this answer below. – Gusto