diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-02-04 18:04:22 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2008-02-04 18:04:22 (GMT) |
commit | 33ae2dc5487a00a89a18fd0eae39258f818b8868 (patch) | |
tree | 9e04278cdddb426711804e13a82b170588b5e8a6 /bin/sugar-launch | |
parent | d08dcbf054406a6b04f82fd88593bb0b2de1ad29 (diff) |
Remove get_bin_path usage.
Diffstat (limited to 'bin/sugar-launch')
-rw-r--r-- | bin/sugar-launch | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bin/sugar-launch b/bin/sugar-launch index e47cb1e..a0a5387 100644 --- a/bin/sugar-launch +++ b/bin/sugar-launch @@ -42,12 +42,25 @@ if len(activities) == 0: activity = activities[0] cmd_args = activityfactory.get_command(activity) +def _which(exec_file): + if 'PATH' in os.environ: + envpath = os.environ['PATH'] + else: + envpath = defpath + + for path in envpath.split(os.pathsep): + fullname = os.path.join(path, exec_file) + if os.path.exists(fullname): + return fullname + + return None + def _get_interpreter(exec_file): if os.path.exists(exec_file): abs_path = exec_file else: - abs_path = os.path.join(env.get_bin_path(), exec_file) - if not os.path.exists(abs_path): + abs_path = _which(exec_file) + if not abs_path: return exec_file f = open(abs_path) |