Open Relative Local File
I'm trying to open a PDF file stored in my working directory. I know openUrl() needs a full path. How can I generate the full path of the current directory, then supply it here to open? I want this to run correctly regardless of where the tarball was extracted.
I imagine I would have to use QDir::currentPath() then append the PDF filename. I'm not sure how to do that though.
Hi and welcome to devnet,
Do you mean that the file is in the same folder as the application ?
In that case you can use
@QString applicationPath = QCoreApplication::applicationFilePath()
QDesktopServices::openUrl(QUrl::fromLocalFile(applicationPath + "/UserGuide.pdf"));@
Hope it helps