Loading an html file next to app on OSX
Unsolved
QML and Qt Quick
-
Using
WebEngineView
, I'm trying to automatically load at launch an html file which is in the same directory as my .app bundle.--DemoDirectory
-----Demo.app
-----demo1.htmlI've discovered that
QGuiApplication::applicationDirPath()
points to a directory inside the bundle so that wasn't working.I made somewhat hackish progress with the code snippet below.After concatenating the html file name, the path I end up with is
/Users/Tomato/Documents/builds/build-Timeline_Demo-Desktop_Qt_5_5_1_clang_64bit-Release/demo1.html
Which of course doesn't work, so I tried prepending `file://" on to that and still no joy. Am I doing something obviously wrong?
-in main.cpp
QDir dir = QDir(QCoreApplication::applicationDirPath()); dir.cdUp(); dir.cdUp(); dir.cdUp(); engine.rootContext()->setContextProperty("workingDirectory", dir.absolutePath());