I have some files in a .qrc file like this:
<file>objs/cube.obj</file>
<file>objs/cube.obj</file>
To copy to clipboard, switch view to plain text mode
and I want to resolve the absolute path to that file into a char * array.
I tried all sorts of combinations of QDir,QFile, and QFileInfo with no luck, does anyone have any ideas?
//filename = ":/objs/cube.obj" here
QByteArray ba
= info.
absoluteFilePath().
toLatin1();
//file.fileName().toLatin1();// const char *filename = ba.data();
QMessageBox::about(this, tr
("test"),tr
("filename = %1").
arg(filename
) );
//this outputs "filename = :/objs/cube.obj"
//filename = ":/objs/cube.obj" here
QFile file(fileName);
file.open(QIODevice::ReadOnly);
QFileInfo info(file);
QByteArray ba = info.absoluteFilePath().toLatin1();//file.fileName().toLatin1();//
const char *filename = ba.data();
QMessageBox::about(this, tr("test"),tr("filename = %1").arg(filename) );
//this outputs "filename = :/objs/cube.obj"
To copy to clipboard, switch view to plain text mode
Bookmarks