mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
chore: change qt version
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var local_qt_theme bool
|
||||
@@ -16,18 +15,19 @@ func Launcher() {
|
||||
wd, _ := filepath.Abs(".")
|
||||
|
||||
_debug := flag.Bool("debug", false, "Debug mode")
|
||||
flag.BoolVar(&local_qt_theme, "theme", false, "Use local QT theme (unstable)")
|
||||
flag.Parse()
|
||||
|
||||
// Find & symlink some Qt Plugin to enable system theme
|
||||
tryLinkQtPlugin("styles", !local_qt_theme)
|
||||
tryLinkQtPlugin("platformthemes", !local_qt_theme)
|
||||
|
||||
cmd := exec.Command("./nekoray", flag.Args()...)
|
||||
cmd.Env = os.Environ()
|
||||
|
||||
ld_env := "LD_LIBRARY_PATH=" + filepath.Join(wd, "./usr/lib")
|
||||
cmd.Env = append(cmd.Env, ld_env)
|
||||
log.Println(ld_env, cmd)
|
||||
qt_plugin_env := "QT_PLUGIN_PATH=" + filepath.Join(wd, "./usr/plugins")
|
||||
|
||||
// Qt 5.12 abi is usually compatible with system Qt 5.15
|
||||
// But use package Qt 5.12 by default.
|
||||
cmd.Env = os.Environ()
|
||||
cmd.Env = append(cmd.Env, "NKR_FROM_LAUNCHER=1")
|
||||
cmd.Env = append(cmd.Env, ld_env, qt_plugin_env)
|
||||
log.Println(ld_env, qt_plugin_env, cmd)
|
||||
|
||||
if *_debug {
|
||||
cmd.Env = append(cmd.Env, "QT_DEBUG_PLUGINS=1")
|
||||
@@ -39,39 +39,3 @@ func Launcher() {
|
||||
cmd.Start()
|
||||
}
|
||||
}
|
||||
|
||||
func tryLinkQtPlugin(sub string, remove bool) {
|
||||
wd_plugins_sub := filepath.Join("./usr/plugins", sub)
|
||||
|
||||
if Exist(wd_plugins_sub) {
|
||||
if remove {
|
||||
os.RemoveAll(wd_plugins_sub)
|
||||
}
|
||||
} else {
|
||||
if remove {
|
||||
return
|
||||
}
|
||||
|
||||
arch := "x86_64"
|
||||
if runtime.GOARCH == "arm64" {
|
||||
arch = "aarch64"
|
||||
}
|
||||
|
||||
paths := []string{
|
||||
filepath.Join("/usr/lib/qt5/plugins", sub),
|
||||
filepath.Join("/usr/lib64/qt5/plugins", sub),
|
||||
filepath.Join("/usr/lib/"+arch+"-linux-gnu/qt5/plugins", sub),
|
||||
filepath.Join("/usr/lib/qt/plugins", sub),
|
||||
}
|
||||
path := FindExist(paths)
|
||||
if path == "" {
|
||||
log.Println("warning:", sub, "not found")
|
||||
return
|
||||
}
|
||||
|
||||
err := os.Symlink(path, wd_plugins_sub)
|
||||
if err != nil {
|
||||
log.Println("symlink failed:", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user