I need a similar to .NET method for safely combining path parts without worrying for platform specifics of the path separator.
Is there such class and method in QT4?
Something like:
QPath::Combine
I need a similar to .NET method for safely combining path parts without worrying for platform specifics of the path separator.
Is there such class and method in QT4?
Something like:
QPath::Combine
You may use the static methods QDir::fromNativeSeparators
and QDir::toNativeSeparators
and then use /
everywhere when manipulating the path.
I don't know of anything exactly like that, but you can get close by using QDir::cd()
:
QDir path("base_path");
path.cd("subdir");
Unfortunately, I think that only works for directories, not files. For files, you could use QDir::filePath()
:
QDir path("base_path");
QString file_path = path.filePath("file.txt");