Merge lp:~mardy/webbrowser-app/qml-path into lp:webbrowser-app

Proposed by Alberto Mardegan on 2016-12-19
Status: Needs review
Proposed branch: lp:~mardy/webbrowser-app/qml-path
Merge into: lp:webbrowser-app
Diff against target: 48 lines (+24/-2)
1 file modified
src/app/config.h.in (+24/-2)
To merge this branch: bzr merge lp:~mardy/webbrowser-app/qml-path
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing on 2016-12-19
Ubuntu Phablet Team 2016-12-19 Pending
Review via email: mp+313535@code.launchpad.net

Commit Message

Find QML files even if relocated

When the webbrowser-app or webapp-container is run from inside a snap and provided by another snap (such as ubuntu-app-platform), the only reliable way to locate the data files is to walk up the bindir and then descend into the datadir.
This way allows us to locate the data file regardless of any relocation of the package.

Description of the Change

Find QML files even if relocated

When the webbrowser-app or webapp-container is run from inside a snap and provided by another snap (such as ubuntu-app-platform), the only reliable way to locate the data files is to walk up the bindir and then descend into the datadir.
This way allows us to locate the data file regardless of any relocation of the package.

To post a comment you must log in.
Olivier Tilloy (osomon) wrote :

I haven’t reviewed the actual change, but it’s conditional on reaching an agreement on bug #1646187, IIUC. Can you please ping me again when we have an agreement, and this kind of trick becomes necessary? Thanks!

FAILED: Continuous integration, rev:1565
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/731/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/2204
    UNSTABLE: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/571
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/2207
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=zesty/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=zesty/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=zesty/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=zesty/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/2034/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=zesty/2034
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=zesty/2034/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-webbrowser-app-ci/731/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

1565. By Alberto Mardegan on 2016-12-19

Properly find qml files even if relocated

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/config.h.in'
2--- src/app/config.h.in 2016-07-12 11:54:37 +0000
3+++ src/app/config.h.in 2016-12-19 13:40:44 +0000
4@@ -22,20 +22,42 @@
5 #include <QtCore/QCoreApplication>
6 #include <QtCore/QDir>
7 #include <QtCore/QString>
8+#include <QtCore/QStringList>
9 #include <QtCore/QtGlobal>
10
11 #define REMOTE_INSPECTOR_PORT 9221
12
13 inline bool isRunningInstalled()
14 {
15- static bool installed = (QCoreApplication::applicationDirPath() == QDir(qgetenv("SNAP").append("@CMAKE_INSTALL_FULL_BINDIR@")).canonicalPath());
16+ static bool installed = QCoreApplication::applicationDirPath().endsWith("@CMAKE_INSTALL_FULL_BINDIR@");
17 return installed;
18 }
19
20 inline QString UbuntuBrowserDirectory()
21 {
22 if (isRunningInstalled()) {
23- return qgetenv("SNAP").append("@CMAKE_INSTALL_FULL_DATADIR@/webbrowser-app");
24+ QDir dir(QCoreApplication::applicationDirPath());
25+ bool ok = true;
26+
27+ QStringList parts(QString("@CMAKE_INSTALL_FULL_BINDIR@")
28+ .split(QDir::separator(), QString::SkipEmptyParts));
29+ Q_FOREACH(const QString &part, parts) {
30+ if (!dir.cdUp()) {
31+ ok = false;
32+ break;
33+ }
34+ }
35+
36+ parts = QStringList(QString("@CMAKE_INSTALL_FULL_DATADIR@/webbrowser-app")
37+ .split(QDir::separator(), QString::SkipEmptyParts));
38+ Q_FOREACH(const QString &part, parts) {
39+ if (!dir.cd(part)) {
40+ ok = false;
41+ break;
42+ }
43+ }
44+
45+ return ok ? dir.path() : qgetenv("SNAP").append("@CMAKE_INSTALL_FULL_DATADIR@/webbrowser-app");
46 } else {
47 return QStringLiteral("@CMAKE_SOURCE_DIR@/src/app");
48 }

Subscribers

People subscribed via source and target branches

to status/vote changes: