Skip to content

Commit

Permalink
check if the environmental variable APPIMAGE is invalid and act as ne…
Browse files Browse the repository at this point in the history
…eded
  • Loading branch information
antony-jr committed Apr 20, 2020
1 parent a04e07a commit bd79e7f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/appimageupdateinformation_p.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,14 @@ void AppImageUpdateInformationPrivate::getInfo(void) {
setAppImage(QProcessEnvironment::systemEnvironment().value("APPIMAGE"));
bc.lock();

// Check if it's a AppImageLauncher's path, if so then use the map file to
// get the actual appimage path.
QRegExp rx(QString::fromUtf8("/run/user/*/appimagelauncherfs/*.AppImage"));
rx.setPatternSyntax(QRegExp::Wildcard);

/*
* Lets try getting it from QCoreApplication arguments. */
if(s_AppImagePath.isEmpty()) {
if(s_AppImagePath.isEmpty() || rx.exactMatch(s_AppImagePath)) {
auto arguments = QCoreApplication::arguments();
if(!arguments.isEmpty()) {
bc.unlock();
Expand Down Expand Up @@ -589,8 +593,8 @@ void AppImageUpdateInformationPrivate::getInfo(void) {
QCoreApplication::processEvents();

auto magicBytes = read(p_AppImage, /*offset=*/8,/*maxchars=*/ 3);
if (magicBytes[0] != 'A' && magicBytes[1] != 'I') {
/*
if (magicBytes[0] != 'A' || magicBytes[1] != 'I') {
/*
* If its not an AppImage then lets check if its a linux desktop file , If so then parse the 'Exec'
* to find the actual AppImage.
*/
Expand Down

0 comments on commit bd79e7f

Please sign in to comment.