Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

os.path.join() in Qt?

I'm looking for an easy, cross platform way to join path, directory and file names into a complete path in C++. I know python has os.path.join() and matlab has fullfile(). Does Qt has something similar? QFileInfo doesn't seem to be able to do this.

like image 788
shoosh Avatar asked Feb 07 '10 15:02

shoosh


2 Answers

QDir has absoluteFilePath and relativeFilePath to combine a path with a file name.

like image 51
Sofahamster Avatar answered Sep 21 '22 19:09

Sofahamster


Offhand, I'm not sure about Qt, but Boost has a filesystem class that handles things like this. This has the advantage that it has been accepted as a proposal for TR2. That means it has a pretty good chance of becoming part of the C++ standard library (though probably with some minor modifications here or there).

like image 26
Jerry Coffin Avatar answered Sep 18 '22 19:09

Jerry Coffin