Skip to content

Commit a282b92

Browse files
committed
better AppImage support
1 parent d923ddd commit a282b92

File tree

2 files changed

+13
-36
lines changed

2 files changed

+13
-36
lines changed

doc/REQUIREMENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ qmake -qt=qt5
2828
make
2929
```
3030

31-
Please note that PEB builds using the ``QtWebKit`` web engine are single-process applications consuming less memory than PEB builds using the ``QtWebEngine``, which are multiprocess applications.
31+
Please note that PEB builds using the ``QtWebKit`` web engine are single-process applications consuming less memory than PEB builds using the ``QtWebEngine`` which are multiprocess applications.
3232

3333
## Compile-Time Settings
3434
All compile-time settings require editing the ``src/peb.pro`` project file according to the following instructions.

src/main.cpp

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,18 @@ int main(int argc, char **argv)
116116

117117
QString browserDirectory = executableDirectory.absolutePath().toLatin1();
118118

119+
#ifdef Q_OS_LINUX
120+
QByteArray appImageEnvVariable = qgetenv("APPIMAGE");
121+
122+
if (appImageEnvVariable.length() > 0) {
123+
QFileInfo appImageFileInfo =
124+
QFileInfo(QString::fromLatin1(appImageEnvVariable));
125+
QString appImageDirectory = appImageFileInfo.path();
126+
127+
browserDirectory = appImageDirectory;
128+
}
129+
#endif
130+
119131
// ==============================
120132
// Perl directory:
121133
// ==============================
@@ -163,23 +175,6 @@ int main(int argc, char **argv)
163175

164176
QString resourcesDirectory = browserDirectory + "/resources";
165177

166-
#ifdef Q_OS_LINUX
167-
QByteArray appImageEnvVariable = qgetenv("APPIMAGE");
168-
QString appImageResourcesDirectory;
169-
170-
if (appImageEnvVariable.length() > 0) {
171-
QFileInfo appImageFileInfo =
172-
QFileInfo(QString::fromLatin1(appImageEnvVariable));
173-
174-
QString appImageDirectory = appImageFileInfo.path();
175-
QString appImageName = appImageFileInfo.baseName();
176-
177-
appImageResourcesDirectory =
178-
appImageDirectory + "/"
179-
+ appImageName + "-resources";
180-
}
181-
#endif
182-
183178
// ==============================
184179
// Application directory:
185180
// ==============================
@@ -192,18 +187,6 @@ int main(int argc, char **argv)
192187
// ==============================
193188
QString dataDirName = resourcesDirectory + "/data";
194189

195-
#ifdef Q_OS_LINUX
196-
if (appImageEnvVariable.length() > 0) {
197-
dataDirName = appImageResourcesDirectory + "/data";
198-
199-
QDir dataDir(dataDirName);
200-
201-
if (!dataDir.exists()) {
202-
dataDir.mkpath(dataDirName);
203-
}
204-
}
205-
#endif
206-
207190
qputenv("PEB_DATA_DIR", dataDirName.toLatin1());
208191

209192
// ==============================
@@ -233,12 +216,6 @@ int main(int argc, char **argv)
233216

234217
QString logDirFullPath = resourcesDirectory + "/logs";
235218

236-
#ifdef Q_OS_LINUX
237-
if (appImageEnvVariable.length() > 0) {
238-
logDirFullPath = appImageResourcesDirectory + "/logs";
239-
}
240-
#endif
241-
242219
QDir logDir(logDirFullPath);
243220
if (logDir.exists()) {
244221
application.setProperty("logDirFullPath", logDirFullPath);

0 commit comments

Comments
 (0)