Il 12/04/19 17:09, Jason H ha scritto:
I often miss Node and Python that has a path appender. This could have been tedious 
in the past but in C++11, QDir::join({parts, of, a, path, and, filename})  
(declared as static QDir::join(const QStringList& parts);)
I'm aware that Qt makes file path delimiters OS-agnostic, but I find myself missing the construct as a logical concept.

It's non trivial in the presence of parts which design absolute paths, and, Qt should stop adding filesystem convenience APIs before having a serious discussion on its evolution (e.g. dropping QString in favour of a filesystem path class).

For instance, see the complicated (confusing?) behaviour of operator/ for std::filesystem::path:

https://en.cppreference.com/w/cpp/filesystem/path/append



Also consider:

source ="file://"  + appPath+ "/" + filename

*DO NOT CREATE URLS BY CONCATENATING PIECES*!

Use QUrl properly (QUrl::fromLocalFile, in this case).


My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to