Skip to content

Commit

Permalink
Also use $QT_ROOT_DIR (#302)
Browse files Browse the repository at this point in the history
* Also use $QT_ROOT_DIR

Also use the environment variable `$QT_ROOT_DIR`

#300 (comment)

* Check for the return value of prfxpathPos

#300 (comment)

Thanks @kevle
  • Loading branch information
probonopd authored Dec 1, 2024
1 parent 6bb9713 commit fced8b8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/appimagetool/appdirtool.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,12 @@ func patchQtPrfxpath(appdir helpers.AppDir, lib string, libraryLocationsInAppDir
f.Seek(0, 0)
// Search from the beginning of the file
search := []byte("qt_prfxpath=")
offset := ScanFile(f, search) + int64(len(search))
prfxpathPos := ScanFile(f, search)
if prfxpathPos < 0 {
helpers.PrintError("Could not find offset for " + string(search), errors.New("no " + string(search) + " token in binary"))
os.Exit(1)
}
offset := prfxpathPos + int64(len(search))
log.Println("Offset of qt_prfxpath:", offset)
/*
What does qt_prfxpath=. actually mean on a Linux system? Where is "."?
Expand Down Expand Up @@ -1487,11 +1492,14 @@ func handleQt(appdir helpers.AppDir, qtVersion int) {

func getQtPrfxpath(f *os.File, err error, qtVersion int) string {

// If the user has set $QTDIR, use that instead of the one from qt_prfxpath in the library
// If the user has set $QTDIR or $QT_ROOT_DIR, use that instead of the one from qt_prfxpath in the library
qtPrefixEnv := os.Getenv("QTDIR")
if qtPrefixEnv == "" {
qtPrefixEnv = os.Getenv("QT_ROOT_DIR")
}
if qtPrefixEnv != "" {
log.Println("Using $QTDIR:", qtPrefixEnv)
return qtPrefixEnv
log.Println("Using QTDIR or QT_ROOT_DIR:", qtPrefixEnv)
return qtPrefixEnv
}

f.Seek(0, 0)
Expand Down

0 comments on commit fced8b8

Please sign in to comment.