mirror of
https://github.com/lutris/lutris
synced 2024-10-14 11:42:36 +00:00
use ldconfig for gamemodepath and LIB for gamemodeauto
This commit is contained in:
parent
a51a017b6f
commit
1d6ee4cc22
|
@ -398,7 +398,7 @@ class Game(GObject.Object):
|
|||
if gamemode:
|
||||
env['LD_PRELOAD'] = ':'.join([
|
||||
path for path in
|
||||
[env.get('LD_PRELOAD'), system.GAMEMODE_PATH]
|
||||
[env.get('LD_PRELOAD'), "/usr/$LIB/libgamemodeauto.so.0"]
|
||||
if path
|
||||
])
|
||||
|
||||
|
|
|
@ -105,8 +105,8 @@ system_options = [ # pylint: disable=invalid-name
|
|||
{
|
||||
'option': 'gamemode',
|
||||
'type': 'bool',
|
||||
'default': bool(system.GAMEMODE_PATH),
|
||||
'condition': bool(system.GAMEMODE_PATH),
|
||||
'default': bool(system.find_lib("libgamemodeauto.so.0")),
|
||||
'condition': bool(system.find_lib("libgamemodeauto.so.0")),
|
||||
'label': 'Enable Feral gamemode',
|
||||
'help': 'Request a set of optimisations be temporarily applied to the host OS'
|
||||
},
|
||||
|
|
|
@ -46,17 +46,6 @@ INSTALLED_TERMINALS = []
|
|||
# Detect if system is 64bit capable
|
||||
IS_64BIT = sys.maxsize > 2**32
|
||||
|
||||
# Path to Feral gamemode library
|
||||
GAMEMODE_PATH = next(
|
||||
(
|
||||
path for path in map(
|
||||
lambda x: os.path.join(x, 'libgamemodeauto.so'),
|
||||
['/usr/lib/x86_64-linux-gnu', '/usr/lib']
|
||||
) if os.path.exists(path)
|
||||
),
|
||||
None
|
||||
)
|
||||
|
||||
|
||||
def execute(command, env=None, cwd=None, log_errors=False, quiet=False, shell=False):
|
||||
"""
|
||||
|
@ -455,3 +444,18 @@ def is_running(process):
|
|||
if re.search(process, x):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def find_lib(libname):
|
||||
"""Returns a list of absoulte paths found in the system of a given library"""
|
||||
lib_paths = []
|
||||
ldconfig_cmd = find_executable("ldconfig")
|
||||
if ldconfig_cmd:
|
||||
ldconfig_out = subprocess.check_output(
|
||||
[ldconfig_cmd, "-p"]).decode("UTF-8")
|
||||
for out in ldconfig_out.splitlines():
|
||||
if libname in out:
|
||||
lib_paths.append(out.split("=> ")[1])
|
||||
else:
|
||||
logger.error("ldconfig not found, can't search for lib %s", libname)
|
||||
return lib_paths
|
||||
|
|
Loading…
Reference in a new issue