Details
-
Bug
-
Resolution: Duplicate
-
Not Evaluated
-
None
-
6.6.0
-
None
Description
For QUrl when you use the path() function to get the path. The path starts with a / which is correct on *Nix system. However it is not on Windows. This can be verify by the code below:
import pathlib
path = pathlib.Path('/C:')
print(f'Path:
path = pathlib.Path('C:')
print(f'Path: {path}
Exists:
{path.exists()}')
The first print statment prints that the path does not exists whilst the second prints that it does.
Therefore, on windows you will have to remove the leading `/` in the path return by QUrl.path.
I have attached a code example that makes a valid path using QUrl and QFileDialog.
Attachments
Issue Links
- duplicates
-
QTBUG-6868 QUrl ( const QString & url ) / path() problem on windows for local files
- Closed