PDA

View Full Version : QFileInfo



ishkabible
19th September 2010, 23:37
so im trying to use QFileInfo to do a number of things, i'm struggling with how to take a full file path and take off the sufix and add a new one. i preety sure that QFileInfo can do this i just don't know how. i think there is a way to get the filepath that excludes the filename it'self, just the directory it's in is what i need. is there a way to do this?

wysota
19th September 2010, 23:58
i'm struggling with how to take a full file path
QFileInfo::absoluteFilePath()

and take off the sufix
QFileInfo::baseName()

and add a new one.
QString::append


i think there is a way to get the filepath that excludes the filename it'self, just the directory it's in is what i need.
QFileInfo::absoluteDir() or QFileInfo::absolutePath()


is there a way to do this?
Yes, read the docs of the class you are using.

ishkabible
20th September 2010, 00:03
thanks i got it to work, kinda long though



system(QString(QFileInfo(FileNames[Tabs->currentIndex()]).dir().absolutePath()+"/"+GetApplicationName(FileNames[Tabs->currentIndex()])+".exe").toAscii());

wysota
20th September 2010, 00:08
What is this exactly supposed to do?