@EchoReaper said in How to create a new QDir from an existing QDir + a subfolder?:
Normally, scripting languages will you allow to do something like QDir folderInput = input / "SubfolderName", but Qt doesn't. I could just use what I have above, but I'm not a fan of it because it hardcodes the slash. I could do input.path() + QDir::separator() + "SubfolderName", but that's too verbose. Does Qt have a more desirable way to index a subfolder of an existing QDir?
I would say the "correct" Qt way of producing the path to a sub-folder, without using / or QDir::separator() the way you have (which isn't great if your starting directory ends with a /, like / or C:/, e.g. when QDir::isRoot() == true), is to use https://doc.qt.io/qt-5/qfileinfo.html#setFile-2, void QFileInfo::setFile(const QDir &dir, const QString &file).
You/Qt don't know whether the sub-item is a file or directory, that's why it's a QFileInfo method rather than a QDir one. You can then, say, feed QFileInfo::absoluteFilePath() to a new QDir() if you want to access it as a directory.
If you actually wish to create the sub-directory you could use https://doc.qt.io/qt-5/qdir.html#mkdir or https://doc.qt.io/qt-5/qdir.html#mkpath.