mirror of
https://github.com/gryf/wicd.git
synced 2026-01-07 22:34:18 +01:00
Tweak algorithm for searching for sudo progs so we search every directory in $PATH for a particular app before moving on to the next one.
This commit is contained in:
14
wicd/misc.py
14
wicd/misc.py
@@ -409,17 +409,19 @@ def choose_sudo_prog(prog_num=0):
|
||||
return find_path(sudo_dict[prog_num])
|
||||
desktop_env = detect_desktop_environment()
|
||||
env_path = os.environ['PATH'].split(":")
|
||||
paths = []
|
||||
|
||||
if desktop_env == "kde":
|
||||
paths = []
|
||||
for p in env_path:
|
||||
paths.extend([p + '/kdesu', p + '/kdesudo', p + '/ktsuss'])
|
||||
progs = ["kdesu", "kdesudo", "ktusss"]
|
||||
else:
|
||||
paths = []
|
||||
for p in env_path:
|
||||
paths.extend([p + '/gksudo', p + "/gksu", p + '/ktsuss'])
|
||||
progs = ["gksudo", "gksu", "ktsuss"]
|
||||
|
||||
for prog in progs:
|
||||
paths.extend([os.path.join(p, prog) for p in env_path])
|
||||
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
print "returning %s" % path
|
||||
return path
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user